splitString: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (example) |
Killzone Kid (talk | contribs) (example) |
||
Line 7: | Line 7: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| An SQF version of C++ [http://www.cplusplus.com/reference/cstring/strtok/ strtok]. Splits given string ''str'' into an array of tokens according to given ''delimeters''.|= Description | | An SQF version of C++ [http://www.cplusplus.com/reference/cstring/strtok/ strtok]. Splits given string ''str'' into an array of tokens according to given ''delimeters''. In addition, if empty string "" is used for ''delimiters'', ''str'' is split by each character.|= Description | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 26: | Line 26: | ||
|x4= <code>["test","test"] [[joinString]] [[toString]] [12345] [[splitString]] [[toString]] [12345]; // ["test","test"]</code>|= Example 4 | |x4= <code>["test","test"] [[joinString]] [[toString]] [12345] [[splitString]] [[toString]] [12345]; // ["test","test"]</code>|= Example 4 | ||
|x5= <code>"Japa is the best!" [[splitString]] "" [[joinString]] " "; // "J a p a i s t h e b e s t !"</code>|= Example 5 | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Revision as of 18:19, 5 August 2015
Description
- Description:
- An SQF version of C++ strtok. Splits given string str into an array of tokens according to given delimeters. In addition, if empty string "" is used for delimiters, str is split by each character.
- Groups:
- Uncategorised
Syntax
- Syntax:
- str splitString delimeters
- Parameters:
- str: String - A string to split
- delimeters: String - one or more characters, each used as a separate delimeter.
- Return Value:
- Array
Examples
- Example 1:
_str = "- This, is a sample string." splitString "-,. "; // ["This","is","a","sample","string"] _str joinString " "; // "This is a sample string"
- Example 2:
"\A3\ui_f\data\map\vehicleicons\iconLogic_ca.paa" splitString "\."; // ["A3","ui_f","data","map","vehicleicons","iconLogic_ca","paa"]
- Example 3:
"1:2:3" splitString ":"; // ["1","2","3"]
- Example 4:
["test","test"] joinString toString [12345] splitString toString [12345]; // ["test","test"]
- Example 5:
"Japa is the best!" splitString "" joinString " "; // "J a p a i s t h e b e s t !"
Additional Information
- See also:
- joinStringsetresizereverseselectinfindtoArrayforEachcountdeleteAtdeleteRangeappendsortparamparamsarrayIntersecttoStringUnicode Character Table
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
[[Category:Introduced with arma3dev version 1.49]][[ Category: arma3dev: New Scripting Commands | SPLITSTRING]][[ Category: arma3dev: Scripting Commands | SPLITSTRING]]