Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
No edit summary
Line 2: Line 2:
   
 
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
 
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
  +
Splits a string using a delimiter
One line summary description of function.
 
 
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
 
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
isTrue, retVal1, retVal2 = func("arg1", arg2, ...)
+
s1, s2, s3 ... sn = strsplit("delimiter", "subject")
   
   

Revision as of 18:54, 20 September 2007

Splits a string using a delimiter

s1, s2, s3 ... sn = strsplit("delimiter", "subject")


Arguments

(delimiter, subject)
delimiter
String - Delimiter
subejct
String - String to split


Returns

A list of strings. Not a table.

Example

local a, b, c = strsplit(",", "a b c")

Result

a = "a"
b = "b"
c = "c"

Details

To get a table use:

local tbl = { strsplit(delimiter, subject) }