Last active
March 25, 2019 03:19
-
-
Save rangercyh/f042a270ecd405038c4bc70f5e7da68c to your computer and use it in GitHub Desktop.
traverse utf8 string by char
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function string_dump(s) | |
for p, c in utf8.codes(s) do | |
print(p, utf8.char(c)) | |
end | |
end | |
string_dump('12我3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment