BIS fnc splitString: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(fixed description and parameter)
m (Text replacement - " |r1=[[" to " |r1= [[")
Line 16: Line 16:
|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
|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|Strings]]
|r1= [[Array]] of [[String|Strings]]


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

Revision as of 22:37, 7 August 2021

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:
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