Jump to content

Recommended Posts

Posted

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?

Posted

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 :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...