BIS fnc splitString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <h3 style="display:none">Notes</h3> <dl class="command_description"> <!-- Note Section BEGIN --> <!-- Note Section END --> </dl> " to "")
m (Text replacement - " *\| *([Cc]omments|COMMENTS|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments \("local" or "global"\)|Multiplayer Effects \("local" or "global"\)|Multiplayer Execution \("server" o...)
Line 1: Line 1:
{{Function|Comments=
{{Function


| arma3 |Game name=
| arma3


|1.00|= Game version
|1.00|= Game version


|gr1 = Strings |GROUP1=
|gr1 = Strings


| Split spring according to given separators |DESCRIPTION=
| Split spring according to given separators


| [stringToSplit, separators, byStr] call [[BIS_fnc_splitString]] |SYNTAX=
| [stringToSplit, separators, byStr] 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 "") each letter in it '''is''' a separator if ''byStr'' is [[false]]; not the whole word itself


|p3= byStr: [[Boolean]] - (Optional, default [[false]]) use [[splitString]] if set to [[true]] |PARAMETER3=
|p3= byStr: [[Boolean]] - (Optional, default [[false]]) use [[splitString]] if set to [[true]]


| [[Array]] of [[String|Strings]] |RETURNVALUE=
| [[Array]] of [[String|Strings]]


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


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


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


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




| [[splitString]], [[toArray]], [[toString]] |SEEALSO=
| [[splitString]], [[toArray]], [[toString]]
}}
}}



Revision as of 00:47, 18 January 2021

Hover & click on the images for description

Description

Description:
Split spring according to given separators
Execution:
call
Groups:
Strings

Syntax

Syntax:
[stringToSplit, separators, byStr] call BIS_fnc_splitString
Parameters:
stringToSplit: String
separators: String - (Optional, default "") each letter in it is a separator if byStr is false; not the whole word itself
byStr: Boolean - (Optional, default false) use splitString if set to true
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:
splitStringtoArraytoString

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

Bottom Section