Split string
Hello,
I have a code: Code:
__loadFileClass( )Code:
for( new i = 0; i < iLine; i++ )Code:
[class]Test[item]ItemNameCode:
[class]Test[item]ItemName,ItemName2,...if( equali( classBuffer[ ciName ], szClassNameBlock[ i ] ) && equali( itemBuffer[ iiName ], szItemNameBlock[ i ] ) ) Class Test | ItemName if( equali( classBuffer[ ciName ], szClassNameBlock[ i ] ) && equali( itemBuffer[ iiName ], szItemNameBlock[ i ] ) ) Class Test | ItemName2 |
Re: Split string
You simply need to parse the [item] text as a comma separated string list using strtok() or similar function.
|
Re: Split string
Are you giving an example?
|
Re: Split string
You can use something like that
Spoiler
Edit : Output Code:
] parse |
Re: Split string
SpawnerF, please stop trying to proliferate your dot notation. It provided little if any benefit, is confusing (especially for new coders), and completely unnecessary in this language.
|
Re: Split string
I never said that it's important, it's just my way of coding, sorry if it does bother you but I like it like that.
|
Re: Split string
Strings should never be returned from functions especially general purpose functions.
I'm not sure what angle brackets do for creating an array but it's not wise to use extremely obscure features when providing support on these forums unless it's the only way to do it. containi() returns the position in the string where the search string starts. If it is not found, it will return -1. So "~containi()" will evaluate as True when the string is NOT found and when the string does not start at the beginning. |
Re: Split string
Code:
Strings should never be returned from functions especially general purpose functions.Code:
I'm not sure what angle brackets do for creating an array but it's not wise to use extremely obscure features when providing support on these forums unless it's the only way to do it. |
Re: Split string
Quote:
Quote:
Given this, I don't know how your Split() function can actually work since you are using sizeof in the function's prototype. Not sure why it even compiles. If you need to know the dimensions of the arrays provided to the function, you'll need to pass those dimensions into the function as shown in the URL that you referenced. Did you test your code? |
Re: Split string
Yes it's working. You can try it.
edit : sizeof is a pre-processor function? |
| All times are GMT -4. The time now is 22:49. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.