Raised This Month: $ Target: $400
 0% 

parse string with delimeter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 11-22-2010 , 12:18   Re: parse string with delimeter
Reply With Quote #1

Exolent[jNr] Thx for help.

I did not know how to do function with dynamic number of arguments (searched best way but not found) therefore I did fuction with fixed number of arguments. Probable it will be useful for somebody.

Example:
PHP Code:
new gTempText[5000]
...
public 
parse6(const text[], delimeterarg1[], arg2[], arg3[], arg4[], arg5[], arg6[])
{
    
copy(gTempText4999text)
        
    
strtok(gTempTextarg1999gTempText9999delimeter)
    if (
gTempText[0] == '^0') return 1
    
    strtok
(gTempTextarg2999gTempText9999delimeter)
    if (
gTempText[0] == '^0') return 2
    
    strtok
(gTempTextarg3999gTempText9999delimeter)
    if (
gTempText[0] == '^0') return 3
    
    strtok
(gTempTextarg4999gTempText9999delimeter)
    if (
gTempText[0] == '^0') return 4
    
    strtok
(gTempTextarg5999gTempText9999delimeter)
    if (
gTempText[0] == '^0') return 5
    
    strtok
(gTempTextarg6999gTempText9999delimeter)

    return 
6

Works slower than parse() in ~2.4 times.
-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode