Utf8.remove
Jump to navigation
Jump to search
This function removes a substring in a UTF-8 string by using a position range.
Syntax
string utf8.remove ( string input, int start = 1 [, int stop = -1 ] )
Required Arguments
- input: A string character sequence
- start: An integer representing the beginning position.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- stop: An integer representing the ending position.
Returns
Returns the string with the removed substring from the range.
Example
Click to collapse [-]
ServerThis example shows how to remove substrings from strings.
-- Keep the first and last character local input = "яблоко" local output = utf8.remove( input, 2, -2 ) print( output ) -- яо -- Remove the last character local input = "Банан" local output = utf8.remove( input, -1, -1 ) print( output ) -- Бана
See Also
- utf8.byte
- utf8.char
- utf8.charpos
- utf8.escape
- utf8.find
- utf8.fold
- utf8.gmatch
- utf8.gsub
- utf8.insert
- utf8.len
- utf8.lower
- utf8.match
- utf8.ncasecmp
- utf8.next
- utf8.remove
- utf8.reverse
- utf8.sub
- utf8.title
- utf8.upper
- utf8.width
- utf8.widthindex