ID : 5524
LenB
Function
Return the byte count of character string or numerical value.
This command is available in Ver.1.6.* or higher.
Syntax
LenB(Data )
Guaranteed entry
- Data
- Specify a character string and numerical value and variable. All data types can be specified.
Return value
Return the byte counts of Data by Integer type data.
Description
Return the byte count of character string or numerical value.
- When Data is a character string
- Return the byte count of character string
A single-byte character is regarded as one byte, and a double-byte character is regarded as two bytes.
To count both a single-byte character and a double-byte character as one character, use Len command. -
When Data is a variable
-
Return the byte count of a variable type.
For example, if Integer type variable are specified, “4” is returned. However, if String type variable are specified, the return value is the byte counts of the stored character string. -
When Data is a numerical value
- For example, if “10” is specified, the data is determined as Integer type, and then “4” will be returned.
If "10.1" is specified, the data is determined as Double-precision variable of type real, and then "8" will be returned.
Real number of numerical value is determined as Double-precision variable of type real, not determined as Floating-point variable of type real.
Related Terms
Attention
-
Example
'!TITLE "Obtain the byte count of data"
'Store I-type variable data in the variant type array
Sub Main
Dim vv as Variant
Dim ISize As Integer
iSize = LenB(I0)
vv = CreateArray(iSize*3)
For n=0 to 3
For i=0 to iSize-1
vv(n*iSize+i) = (I[n] >> i*8) And 0xFF
Next
Next
End Sub
ID : 5524