Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -3,26 +3,19 @@ module String_length {
|
|||
Print Len(A$) = 9 ' true Utf-16LE
|
||||
Print Len.Disp(A$) = 4 \\ display length
|
||||
Buffer Clear Mem as Byte*100
|
||||
\\ Write at memory at offset 0 or address Mem(0)
|
||||
Return Mem, 0:=A$
|
||||
Print Eval$(Mem, 0, 18)
|
||||
For i=0 to 17 step 2
|
||||
\\ print hex value and character
|
||||
Hex Eval(Mem, i as integer), ChrCode$(Eval(Mem, i as integer))
|
||||
Buffer Mem2 as Integer*50
|
||||
Mem[0]=A$
|
||||
Print Eval$(Mem, 0, 18) ' 18 bytes from Mem[0] as a string
|
||||
Mem2[0]=Mem
|
||||
For i=0 to 8
|
||||
Hex Mem2[i], ChrCode$(Mem2[i])
|
||||
Next i
|
||||
Document B$=A$
|
||||
\\ encode to utf-8 with BOM (3 bytes 0xEF,0xBB,0xBF)
|
||||
Save.Doc B$, "Checklen.doc", 2
|
||||
Print Filelen("Checklen.doc")=17
|
||||
\\ So length is 14 bytes + 3 the BOM
|
||||
Mem=Buffer("Checklen.doc")
|
||||
Print len(Mem)=17 // len works for buffers too - unit byte
|
||||
// version 12 can handle strings without suffix $
|
||||
C=eval$(mem, 3, 14) // from 4th byte get 14 bytes in a string
|
||||
Print len(C)*2=14 ' bytes // len()) for strings return double type of words (can return 0.5)
|
||||
C=string$(C as utf8dec) ' decode bytes from utf8 to utf16LE
|
||||
Print len(C)=9, C=A$, Len.Disp(C)=4
|
||||
Print C
|
||||
Report 2, C // proportional print on console - for text center justified rendering (2 - center)
|
||||
// Check as UTF8 (UTFEnc and UTF8Dec are selections for string$())
|
||||
Print len(string$(A$ as UTF8Enc))*2=14 ' bytes
|
||||
Locale 1033
|
||||
// to ANSI and back to UTF16LE (destructive)
|
||||
Print chr$(str$(A$))="J_o_s_e´_" ' true
|
||||
Print A$;POS=4 ' J̲o̲s̲é̲True
|
||||
Print String$(A$ as Json)="J\u0332o\u0332s\u0332e\u0301\u0332" ' True
|
||||
}
|
||||
String_length
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue