utf8.remove()

Type Function
Library utf8.*
Return value String
Revision Release 2024.3703
Keywords utf8, UTF-8, Unicode, string, remove
See also utf8.insert()

Overview

Deletes a substring from a UTF-8 string depending on usage:

Note that start and end can be negative if you need to count from the end of the string.

Syntax

utf8.remove( s, start [, end] )
s (required)

String. The string to operate on.

start (required)

Number. The starting position.

end (optional)

Number. Ending position. Default is the number of characters in the string.

Example

local utf8 = require( "plugin.utf8" )

local testStr = "♡ 你好,世界 ♡"
print( utf8.remove( testStr, 5, 7 ) )  --> ♡ 你好 ♡