BIS fnc splitString: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\| *arma3 * * *\| *([0-2]\.[0-9]{2}) * " to "|game1= arma3 |version1= $1 ") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
|gr1= Strings | |gr1= Strings | ||
|descr= | |descr= Splits given string according to given separator(s). | ||
{{Feature|arma3|See [[splitString]].}} | |||
|s1=[stringToSplit, separators, | |s1= [stringToSplit, separators, byWord] call [[BIS_fnc_splitString]] | ||
|p1= stringToSplit: [[String]] | |p1= stringToSplit: [[String]] | ||
|p2= separators: [[String]] - (Optional, default "") each letter | |p2= separators: [[String]] - (Optional, default "") by default each letter is a separator. If ''byWord'' is set to [[true]], the separator will be treated as whole word | ||
|p3= | |p3= byWord: [[Boolean]] - (Optional, default [[false]]) by default uses [[splitString]] behaviour e.g. each letter is a separator. If set to [[true]], the separator will be treated as whole word | ||
|r1=[[Array]] of [[String | |r1= [[Array]] of [[String]]s | ||
|x1= < | |x1= <sqf>["this is a test", " "] call BIS_fnc_splitString; // returns ["this", "is", "a", "test"]</sqf> | ||
|x2= < | |x2= <sqf>["this is a test", "st"] call BIS_fnc_splitString; // returns ["hi"," i"," a ","e"]</sqf> | ||
|x3= < | |x3= <sqf>["this is a test", "is"] call BIS_fnc_splitString; // returns ["th"," "," a te","t"]</sqf> | ||
|x4= < | |x4= <sqf>["this is a test", "is", true] call BIS_fnc_splitString; // returns ["th"," "," a test"]</sqf> | ||
|seealso= [[splitString]] | |seealso= [[splitString]] [[toArray]] [[toString]] | ||
}} | }} |
Latest revision as of 18:01, 30 June 2022
Description
Syntax
- Syntax:
- [stringToSplit, separators, byWord] call BIS_fnc_splitString
- Parameters:
- stringToSplit: String
- separators: String - (Optional, default "") by default each letter is a separator. If byWord is set to true, the separator will be treated as whole word
- byWord: Boolean - (Optional, default false) by default uses splitString behaviour e.g. each letter is a separator. If set to true, the separator will be treated as whole word
- Return Value:
- Array of Strings
Examples
- Example 1:
- Example 2:
- Example 3:
- Example 4:
Additional Information
- See also:
- splitString toArray toString
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