Split a string
Hello!
how do i split a string?
example:
mystr = hello····· 'Start string
ch1 = h············ 'Splited strings
ch2·= e
ch3 = l
ch4 = l
ch5 = o
Regards Martin
how do i split a string?
example:
mystr = hello····· 'Start string
ch1 = h············ 'Splited strings
ch2·= e
ch3 = l
ch4 = l
ch5 = o
Regards Martin

Comments
VAR byte helloStr[noparse][[/noparse] 9 ] PUB main BYTEMOVE(helloStr,6,string("hello")) ' copy the string constant plus its zero byte if strsize(@helloStr) <> 5 ' make sure the string is 5 characters ' do something if helloStr[noparse][[/noparse] 0 ] == "h" ' if so, check the first character ' do something if strcomp(@helloStr,string("hello")) ' you can compare strings for equality this way ' do somethingThe
BYTEMOVE(helloStr,6,string("hello"))should be
BYTEMOVE(@helloStr,string("hello"),6)▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1011, so be surprised!
Advertisement sponsored by dfletch:
Come and join us on the Propeller IRC channel for fast and easy help!
Channel: #propeller
Server: irc.freenode.net or freenode.net
If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com