Squirrel/Server/Functions/Utils/GetTok
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with "{{Squirrel/Title|GetTime}} {{Squirrel/Deprecated|It is recommended that Squirrel's [http://squirrel-lang.org/doc/sqstdlib3.html#d0e1913 system library function], time() be use...") |
|||
Line 1: | Line 1: | ||
− | {{Squirrel/Title| | + | {{Squirrel/Title|GetTok}} |
− | + | ||
This function get one word from the string provided (e.g: Hi, i'm a string) | This function get one word from the string provided (e.g: Hi, i'm a string) | ||
Latest revision as of 11:36, 26 August 2014
This function get one word from the string provided (e.g: Hi, i'm a string)
[edit] Syntax
GetTok ( parameter szParams, string ToJump, int Number )
[edit] Example
This example tells the player the toks "Hi," and "string!"
function onPlayerCommand ( pPlayer, szCommand, szParams ) { switch ( szCommand ) { case "toks": { local String = "Hi, i'ma a string! :D"; local One = GetTok ( String, " ", 1 ); // Get "Hi," local Two = GetTok ( String, " ", 4 ); // Get "string!" MessagePlayer ( One + Two, pPlayer ); } } }
[edit] Notes
The function MessagePlayer and call onPlayerCommand were used in this example. More info about them in corresponding pages.