unity3d - How can I search a .txt file for a keyword in Unityscript? -
What is the correct syntax for searching a .txt file for a keyword in JavaScript?
EDIT: I am working with a subset of JavaScript that is called Unity Script in a program. It outputs to .exe programs. Here is an example of Unity Script:
import system.IO; Function readfile () {var sr = new streamreader (Application.dataPath + "/" + readFilePath); Var File Resource = sr.ReadToEnd (); Sr.Close (); Var lines = fileContents.Split ("~" [0]); (Line in line) {debug.Log (line); }}
I thought that if I can get a function from javascript, then I can import it into my program. Now I think maybe I was wrong.
Thanks - Elite Bonneville
Try it:
Function Process (URL, Send, RegX) {with (new XMLHPRVest) {open (send)? "Post": "GET", URL, false); SetRequestHeader ("content type:" "text / plain"); Send send); If (readyState == 4) RegExp return = = empty? ResponseText.match (RegExp): responseText}} Example: file.txt: name = frank & amp; Id = 12 & amp; Foo = a process ("file.txt", null, /name=([^&]+).id = (\ D +) and amp; foo = ([^ \ n] +) / g)
Comments
Post a Comment