string_set_byte_at

此函数直接在字符串中设置一个字节 (基于UTF8格式),并返回带有更改的字符串的副本。

注意 此函数非常慢,因此请仔细考虑是否有必要使用它以及在哪里使用它。

 

语法:

string_set_byte_at(str, pos, byte);

参数类型描述
strString要更改的字节的字符串。
posReal字符串内的位置 (从1开始) 更改的字节。
byteReal新的字节值。

 

返回:

String

 

例子:

str = string_set_byte_at("hello", 2, 97);

上面的代码将更改字符串中第二个字母的字节值,因此将变量 str 设置为 “hallo”。