BIS fnc splitString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= Game name" to "|Game name=")
m (Some wiki formatting)
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|version1= 1.00


|1.00|= Game version
|gr1= Strings
____________________________________________________________________________________________


| Split spring according to given separators |DESCRIPTION=
|descr= Splits given string according to given separator(s).
____________________________________________________________________________________________
{{Feature|arma3|See [[splitString]].}}


| [stringToSplit, separators, byStr] call [[BIS_fnc_splitString]] |SYNTAX=
|s1= [stringToSplit, separators, byWord] call [[BIS_fnc_splitString]]


|p1= stringToSplit: [[String]] |PARAMETER1=
|p1= stringToSplit: [[String]]


|p2= separators: [[String]] - (Optional, default "") each letter in it '''is''' a separator if ''byStr'' is [[false]]; not the whole word itself |PARAMETER2=
|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= byStr: [[Boolean]] - (Optional, default [[false]]) use [[splitString]] if set to [[true]] |PARAMETER3=
|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


| [[Array]] of [[String|Strings]] |RETURNVALUE=
|r1= [[Array]] of [[String]]s
____________________________________________________________________________________________


|x1= <code>["this is a test", " "] [[call]] [[BIS_fnc_splitString]]; {{codecomment|// returns ["this", "is", "a", "test"]}}</code> |EXAMPLE1=
|x1= <sqf>["this is a test", " "] call BIS_fnc_splitString; // returns ["this", "is", "a", "test"]</sqf>


|x2= <code>["this is a test", "st"] [[call]] [[BIS_fnc_splitString]]; {{codecomment|// returns ["hi"," i"," a ","e"]}}</code> |EXAMPLE2=
|x2= <sqf>["this is a test", "st"] call BIS_fnc_splitString; // returns ["hi"," i"," a ","e"]</sqf>


|x3= <code>["this is a test", "is"] [[call]] [[BIS_fnc_splitString]]; {{codecomment|// returns ["th"," "," a te","t"]}}</code> |EXAMPLE3=
|x3= <sqf>["this is a test", "is"] call BIS_fnc_splitString; // returns ["th"," "," a te","t"]</sqf>


|x4= <code>["this is a test", "is", [[true]]] [[call]] [[BIS_fnc_splitString]]; {{codecomment|// returns ["th"," "," a test"]}}</code> |EXAMPLE4=
|x4= <sqf>["this is a test", "is", true] call BIS_fnc_splitString; // returns ["th"," "," a test"]</sqf>


____________________________________________________________________________________________
|seealso= [[splitString]] [[toArray]] [[toString]]
 
| [[splitString]], [[toArray]], [[toString]] |SEEALSO=
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Strings|{{uc:splitString}}]]
[[Category:Functions|{{uc:splitString}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:splitString}}]]

Latest revision as of 18:01, 30 June 2022

Hover & click on the images for description

Description

Description:
Splits given string according to given separator(s).
Execution:
call
Groups:
Strings

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:
["this is a test", " "] call BIS_fnc_splitString; // returns ["this", "is", "a", "test"]
Example 2:
["this is a test", "st"] call BIS_fnc_splitString; // returns ["hi"," i"," a ","e"]
Example 3:
["this is a test", "is"] call BIS_fnc_splitString; // returns ["th"," "," a te","t"]
Example 4:
["this is a test", "is", true] call BIS_fnc_splitString; // returns ["th"," "," a test"]

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