utf8.remove | Multi Theft Auto: Wiki Skip to content

utf8.remove

Client-side
Server-side
Shared

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
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • start (default: 1): An integer representing the beginning position.
  • stop (default: -1): An integer representing the ending position.

Returns

  • string: new string value

Returns the string with the removed substring from the range.

Code Examples

shared

This 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) -- Бана