40 lines
830 B
Plaintext
40 lines
830 B
Plaintext
\\ ANSI
|
|
Print Asc("a")
|
|
Print Chr$(Asc("a"))
|
|
\\ Utf16-Le
|
|
Print ChrCode("a")
|
|
Print ChrCode$(ChrCode("a"))
|
|
|
|
\\ (,) is an empty array.
|
|
|
|
Function Codes(a$, localeID=1033) {
|
|
If Len(A$)=0 then =(,) : Exit
|
|
\\ Str$(string) return one byte character
|
|
oldlocale=locale
|
|
locale localeID
|
|
a=Str$(a$)
|
|
locale oldlocale
|
|
Codes=(,)
|
|
locale 1033
|
|
// 1 byte length returns 0.5 from len() ' 1 for 2 bytes.
|
|
// chr$(string) convert to UTF16LE with current LOCALE
|
|
For i=1 to len(a)*2
|
|
Append Codes, (chrcode(chr$(mid$(a,i,1 as byte))),)
|
|
Next i
|
|
locale oldlocale
|
|
=Codes
|
|
}
|
|
Print Codes("abcdΩ", 1032)#str$(", ")
|
|
\\ 97, 98, 99, 100, 217
|
|
|
|
Function CodesUNICODE(a) {
|
|
If Len(a)=0 then =(,) : Exit
|
|
Codes=(,)
|
|
For i=1 to len(a)
|
|
Append Codes, (chrcode(mid$(a,i,1)),)
|
|
Next i
|
|
=Codes
|
|
}
|
|
Print CodesUNICODE("abcdΩ")#str$(", ")
|
|
\\ 97, 98, 99, 100, 937
|