KABUKISTAR Posted July 14, 2008 Posted July 14, 2008 I cannot, for the life of me, get _stringbetween to work properly. I've looked at examples using it, and tried to duplicate the syntax exactly, but it still doesn't seem to work. I tried running a simply script that would just test out _stringbetween: #include <String.au3> #include <File.au3> dim $filetest = "File Writing is working" dim $ostring = "abcStringBetween is Workingxyz" dim $betweenstring = _stringbetween($ostring, "abc", "xyz") dim $betweenstring2 = _stringbetween("abcStringBetween is Workingxyz", "abc", "xyz") $file = fileopen("test.txt", 1) filewriteline($file, $filetest) filewriteline($file, $betweenstring) filewriteLine($file, $betweenstring2) The resulting test.txt file contains the line "File Writing is Working", followed by two blank lines. Can anyone tell me what I'm doing wrong?
enaiman Posted July 14, 2008 Posted July 14, 2008 I guess you haven't looked in the help file (or you have but missed this part) Return Value Success: A 0 based $array[0] contains the first found string. Failure: 0 @Error - 1 = No inbetween string found. so, in order for your script to work you need to write an array element. #include <String.au3> #include <File.au3> dim $filetest = "File Writing is working" dim $ostring = "abcStringBetween is Workingxyz" $betweenstring = _stringbetween($ostring, "abc", "xyz") $file = fileopen("test.txt", 1) filewriteline($file, $filetest) filewriteline($file, $betweenstring[0]) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
KABUKISTAR Posted July 14, 2008 Author Posted July 14, 2008 Ah, thank you very much. I can get it to work now.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now