MiserableLife Posted April 6, 2010 Posted April 6, 2010 What is the difference between StringSplit('a,b,c,d',',',0) and StringSplit('a,b,c,d',',',1) Test code: $k = StringSplit('a,b,c,d',',',0) For $i = 1 to $k[0] ConsoleWrite($k[$i]) Next ConsoleWrite(@CRLF) $k = StringSplit('a,b,c,d',',',1) For $i = 1 to $k[0] ConsoleWrite($k[$i]) Next ConsoleWrite(@CRLF)
somdcomputerguy Posted April 6, 2010 Posted April 6, 2010 This is how I see it, which means it's probably wrong..Let's assume the delimiter string is ,.?. With flag 0, any of those 3 delimiter characters will be used to SplitTheString. With flag 1, all three of those characters are needed. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
MiserableLife Posted April 6, 2010 Author Posted April 6, 2010 But when I run the test code, my result was: abcd abcd '0' What happened to the , in the second line? I thought the result would be: abcd a,b,c,d '0'
somdcomputerguy Posted April 6, 2010 Posted April 6, 2010 I think with only one delimiter character, flags 0 and 1 do the same thing. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
MiserableLife Posted April 6, 2010 Author Posted April 6, 2010 Could you explain what "needed" means ... I still don't quite understand. Thanks.
somdcomputerguy Posted April 6, 2010 Posted April 6, 2010 I've rewritten your code, to explain it better to myself as well #Include <Array.au3> $k = StringSplit('a.b,c,.d',',.',0) _ArrayDisplay($k) $k = StringSplit('a.b,c,.d',',.',1) _ArrayDisplay($k) - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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