all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,24 @@
str = "abcdefghijklmnopqrstuvwxyz"
n, m = 5, 15
print( string.sub( str, n, m ) ) -- efghijklmno
print( string.sub( str, n, -1 ) ) -- efghijklmnopqrstuvwxyz
print( string.sub( str, 1, -2 ) ) -- abcdefghijklmnopqrstuvwxy
pos = string.find( str, "i" )
if pos ~= nil then print( string.sub( str, pos, pos+m ) ) end -- ijklmnopqrstuvwx
pos = string.find( str, "ijk" )
if pos ~= nil then print( string.sub( str, pos, pos+m ) ) end-- ijklmnopqrstuvwx
-- Alternative (more modern) notation
print ( str:sub(n,m) ) -- efghijklmno
print ( str:sub(n) ) -- efghijklmnopqrstuvwxyz
print ( str:sub(1,-2) ) -- abcdefghijklmnopqrstuvwxy
pos = str:find "i"
if pos then print (str:sub(pos,pos+m)) end -- ijklmnopqrstuvwx
pos = str:find "ijk"
if pos then print (str:sub(pos,pos+m)) end d-- ijklmnopqrstuvwx