Get part of a string

Added by iNTERFACEWARE

Use string.sub() to return part of a string, by specifying the start and end positions

Source Code
   -- get the first character
   local s = 'Frida'
   local sub = s:sub(1,1)
   
   -- get the third character
   local s = 'Frida'
   local sub = s:sub(3,3)
   
   -- get characters 2 to 4
   local s = 'Frida'
   local sub = s:sub(2,4)
   
   -- get the all characters from 3 onwards
   local s = 'Frida'
   local sub = s:sub(3)
Description
Use string.sub() to return part of a string, by specifying the start and end positions