split()

From Hack Wars Wiki

Jump to: navigation, search


Information for free function split()
Function split(string input, string regex)
API Attacking, Banking, FTP, Watch, HTTP, Challenges
Description Returns a stringarray representation of s split into groups divided by the regular expression deliminator.


Example

string s[];
s = split("a b c d",char(32));
string j = ""+s;

If you output the variables they will have these values:
j == "[a, b, c, d]"
s[0] == "a"
s[1] == "b"
s[2] == "c"
s[3] == "d"

Note

split() will not work with the divider "." (dot). Two workarounds have been posted in the forum ([1]):

  • split(string, "\\\."); This one is based on the odd fact, that split() uses a regular expression here. Will maybe not work anymore, if the bug is corrected.
  • split(replaceAll(string, ".", ":"), ":"); This one first replaces the dots with colons and then splits with colon as divider. This will work, even if the bug is corrected (see replaceAll() for more details).
Personal tools