Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import unicode
- type
- UTF16String* = seq[Rune16]
- proc utf16*(s: string): UTF16String {.inline.} =
- result = @[]
- for i in s:
- result.add(Rune16(i))
- proc `$`*(self: UTF16String): string =
- result = ""
- for i in self:
- if (int(i) and 0xFF00) != 0: result = result & chr(int(i) and 0xFF00)
- result = result & chr(int(i) and 0xFF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement