Skip to content

Instantly share code, notes, and snippets.

@rangercyh
Last active March 25, 2019 03:19
Show Gist options
  • Save rangercyh/f042a270ecd405038c4bc70f5e7da68c to your computer and use it in GitHub Desktop.
Save rangercyh/f042a270ecd405038c4bc70f5e7da68c to your computer and use it in GitHub Desktop.
traverse utf8 string by char
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