Method
LenB
Warning
This item was deprecated in version 2019r2. Please use String.Bytes as a replacement.
Description
Returns the number of bytes in the specified string.
Usage
result=LenB(string)
OR
result=stringVariable.LenB
Part |
Type |
Description |
---|---|---|
result |
The number of bytes in string. |
|
string |
Any valid string expression. |
|
stringVariable |
Any variable of type String. |
Notes
LenB treats string as a series of bytes, rather than a series of characters. It should be used when string represents binary data. If you need to know the number of characters in string rather than the number of bytes, use the String.Length function.
Sample code
This example uses the LenB function to return the number of bytes in a string.
Dim n As Integer
n = LenB("Hello world") ' returns 11
Dim s As String
s = "Hello World"
n = s.LenB ' returns 11
Compatibility
All project types on all supported operating systems.
See also
String.AscByte, String.ChrByte, String.IndexOfBytes, String.Length, String.MiddleBytes, String.RightBytes functions.