AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   first argument of the string (https://forums.alliedmods.net/showthread.php?t=74515)

Nepopus 07-20-2008 10:40

first argument of the string
 
hello, how can i get first argument(word) of the string if dunno what word and len here is
and second++

atomen 07-20-2008 13:40

Re: first argument of the string
 
How to know how long the string is without parsing each word is probably impossible.
But I would do it this way :
PHP Code:

new const string[] = "This-is-data-1 And-this-is-data2 this-isnt-parsed(3rd-word)";

static 
data1[33], data2[33];
parse(stringdata132data232);

new 
len1 sizeof(data1) - 1;
new 
len2 sizeof(data2) - 1


Nepopus 07-20-2008 13:59

Re: first argument of the string
 
Quote:

Originally Posted by atomen (Post 655602)
How to know how long the string is without parsing each word is probably impossible.
But I would do it this way :
PHP Code:

new const string[] = "This-is-data-1 And-this-is-data2 this-isnt-parsed(3rd-word)";

static 
data1[33], data2[33];
parse(stringdata132data232);

new 
len1 sizeof(data1) - 1;
new 
len2 sizeof(data2) - 1


huh i thought this fills data for a maximum of length characters, thanks
+ karma :)
P.S. then i need strbreak(string, data1, 32, data2, 32)


All times are GMT -4. The time now is 05:29.

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