类型 函数 库 utf8.* 返回值 字符串 修订 版本 2024.3703 关键词 utf8, UTF-8, Unicode, 字符串, 删除 另请参阅 utf8.insert()
从
如果未指定 end
,此函数将从 start
删除字符,直到字符串 (s
) 的末尾。
如果指定了 end
,此函数将删除从 start
到 end
的字符,包括 start
和 end
。
请注意,如果需要从字符串末尾计数,start
和 end
可以为负数。
utf8.remove( s, start [, end] )
字符串. 要操作的字符串。
数字. 起始位置。
数字. 结束位置。默认为字符串中的字符数。
local utf8 = require( "plugin.utf8" ) local testStr = "♡ 你好,世界 ♡" print( utf8.remove( testStr, 5, 7 ) ) --> ♡ 你好 ♡