Str.ins

From OpenEUO
Revision as of 16:45, 11 November 2010 by Ximan (Talk | contribs) (Created page with "== Calling Pattern == Call local s3 = sl.str.ins(s1,s2,n) Args s1,s2 are strings n is a number Results s3 is a string == Usage Example == local s = sl.str local r = s.del...")

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

Calling Pattern

Call

local s3 = sl.str.ins(s1,s2,n)

Args

s1,s2 are strings
n is a number

Results

s3 is a string

Usage Example

local s = sl.str
local r = s.del('One really long string.','really ',12)
print(r)
--> One really really long string.

Description

Inserts string s2 into target string s1 at position n and returns the altered string. s2 is inserted before character n (0 < n <= #s1 + 1).

Upon Error

Ins fails silently. If ins receives incorrect parameter types, then '' (an empty string) is returned.

See Also