Jump to content

Stringleft Is Not Workin' Right


Recommended Posts

Hey fellas,

need some help with the function StringLeft. i'm workin with an array and each element of the array has one of the two following contents:

first choice:

empty line
fooline1
fooline2
fooline3
empty line

second choice:

empty line
empty line
fooline1
fooline2
fooline3
empty line

im checking each element, which is always a string, for the substring:

@CRLF & @CRLF

but this doesnt work. searching any a character in the first line works fine(put some chracters into it), but searching for two empty lines don't.

any ideas?

my script:

$searchstring = @CRLF & @CRLF

For $i = 1 To Ubound($Array)-1
If StringLeft($Array[$i], 5) == $searchstring then
blabla
else
blabla
Next
Link to comment
Share on other sites

$searchstring = @CRLF & @CRLF

For $i = 1 To Ubound($Array)-1
If StringLeft($Array[$i], 5) == $searchstring then
blabla
else
blabla
Next
Well, there's probably an easier way to do what you're doing, but if you'd like to do it this way, @CRLF is only two characters, @CR, and @LF. The fourth line in your script uses StringLeft($Array[$i], 5) == $searchstring. If you make that 4, it should work. If you want, post an actual example of the string(s) you are trying to parse, and I'll see if I can't find a more reliable method.

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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