Str.sep

From OpenEUO
Revision as of 19:08, 11 November 2010 by Ximan (Talk | contribs) (Created page with "== Calling Pattern == Call local r[,...] = sl.str.sep(delim,source[,inline]) Args delim is a string source is a string inline (optional) is not nil Results r is a table of s...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Calling Pattern

Call

local r[,...] = sl.str.sep(delim,source[,inline])

Args

delim is a string
source is a string
inline (optional) is not nil

Results

r is a table of strings
or 
r1...rN are strings


Usage Example

local s = sl.str
local r1,r2,r3 = s.sep(' ','One really long string.',true)
print(r1)
print(r2)
print(r3)
--> One
--> really
--> long

Description

Sep splits the source string into parts based upon a delimiter string, delim. The delimiters are removed from the results. The resultant strings are returned as a table. If the inline argument is provided and has a value other than nil, the results will be returned as a tuple.

Upon Error

Sep fails silently. If sep receives inappropriate arguments then a table with a single empty string is returned (or a single empty string, if inline was specified).

See Also