By the way, LEN does not provide the same return information depending on the string type:
- for a fix-len zstring or a var-len string: the number of actually used characters is returned.
- for a fix-len string: the maximum number of usable characters is returned.
But SIZEOF always provides the same return information whatever the string type:
- the total size of allocated memory is returned.
Code: Select all
Dim As Zstring * 10 flz = "Hello!"
Print "Dim As Zstring * 10 flz = ""Hello!"""
Print " LEN(flz)="&Len(flz), " SIZEOF(flz)="&Sizeof(flz)
Print
Dim As String * 10 fls = "Hello!"
Print "Dim As String * 10 fls = ""Hello!"""
Print " LEN(fls)="&Len(fls), " SIZEOF(fls)="&Sizeof(fls)
Print
Dim As String vls = "Hello!"
Print "Dim As String vls = ""Hello!"""
Print " LEN(vls)="&Len(vls), " SIZEOF(vls)="&Sizeof(vls)
Print
Sleep
Code: Select all
Dim As Zstring * 10 flz = "Hello!"
LEN(flz)=6 SIZEOF(flz)=10
Dim As String * 10 fls = "Hello!"
LEN(fls)=10 SIZEOF(fls)=11
Dim As String vls = "Hello!"
LEN(vls)=6 SIZEOF(vls)=12