Raised This Month: $ Target: $400
 0% 

Split at comma


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rexonspix
Junior Member
Join Date: Oct 2005
Location: Denmark
Old 08-04-2009 , 05:18   Split at comma
Reply With Quote #1

Hello

I need the following script to split a string up by the commas.

Etc:
Code:
new itemtotal[256] = "1,2,3,4,5,6,7,8,9,10";
new item1 .. item10;

split(itemtotal, item1, 0);
split(itemtotal, item2, 1);
Something like that ?
-Thanks
Rexonspix is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-04-2009 , 05:44   Re: Split at comma
Reply With Quote #2

Something like...
PHP Code:
    new itemtotal[] = "1,2,3,4,5,6,7,8,9,10";
    
    new 
iNumszItem[10][6]; //Items 1,2,3,4...array start from 0.
    
while(contain(itemtotal",") != -1)
    {
        
strtok(itemtotalszItem[iNum++], charsmax(szItem), itemtotalcharsmax(itemtotal), ','); //Save each item.
    
}
    
copy(szItem[iNum], charsmax(szItem), itemtotal); //Save the last item "10" because don't have a comma after it. 
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-04-2009 , 05:56   Re: Split at comma
Reply With Quote #3

replace , to space and parse?:0 just an idea..
__________________
xPaw is offline
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 18:24.


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