-
-
Notifications
You must be signed in to change notification settings - Fork 18
string_set_byte_at
drewmccluskey edited this page Dec 15, 2018
·
6 revisions
Set a byte in a string.
string_set_byte_at(str, pos, b);
Argument | Description |
---|---|
string str |
The string to change the byte of. |
int pos |
The position within the string (starting at 1) to change the byte of. |
byte b |
The new byte value. |
Returns: string
This function sets a byte directly in a string (based on the UTF8 format) and returns a copy of the string with the changes.
NOTE: This function is incredibly slow so consider carefully whether it is necessary and where you use it.
string str = string_set_byte_at("hello", 2, 97);
The above code would change the byte value of the second letter in the string, and so set the variable "str" to hold "hallo".
Back to strings