Version 0.55.1

str::split

Splits a string into an array of substrings.

Signatures

  •   string[] split( string& input, string separator )

Details

The function scans input for substrings separated by separator and returns a new array with these substrings.

Example

 #import( "std/str.sps" )
 string s = "Akka bakka bonka rakka";
 echo( str::split( s, " " ) );
 

Output

 <string>["Akka","bakka","bonka","rakka"]
 

Return value

An array of strings, containing the splitted values.

Parameters

input

Specifies the string that gets split into substrings. The string is not modified by the operation.

separator

Specifies the character or string to use for splitting input. If this is an empty string, the entire string will be returned (an array with only one item).

See also

🗙

Search results for