Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.31

Description

Description:Converts a string into an array of strings, split at the delimiter positions.

Syntax

Syntax:[string, delimiter] call fn_vbs_splitString
Parameters:
  • string: String - Base string to split.
  • delimiter: String - Delimiter string (optional, default: comma).
Return Value:Array - Array of strings.

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
_array = ["line1\nline2", "\n"] call fn_vbs_splitString;
// Returns: ["line1","line2"] 
If breaking up a long line defined in the current script, ASCII 10 (for Line Feed) can be used as a delimiter:
_longline = "

line1 line2 "; _array = [_longline, toString[10]] call fn_vbs_splitString;

// Returns: ["line1","line2"]

If breaking up lines read from an external file, ASCII 13,10 (for Carriage Return, Line Feed) can be used as a delimiter:
_lines = [loadFile "mydoc.txt", toString [13,10]] call fn_vbs_splitString;

Additional Information

See also: fn vbs joinString
Multiplayer: 
Problems: 

Notes