StrLenTrim
f90VB Modules
f90VBDefs, f90VBBStrings
Summary
Function StrLenTrim returns the length in number of characters of the input string, excluding trailing blanks and/or the null terminator.
Syntax
| integer(LONG_KIND) function StrLenTrim | (Str) |
| { | |
| character(len=*),intent(in):: | Str | |
| integer(OLECHAR_KIND),dimension(:),intent(in):: | Str | |
| type(OLESTRING),intent(in):: | Str | |
| integer(BSTRHNDL_KIND),intent(in):: | Str |
| } | |
Arguments
Str [Input]
String whose length will be determined. It can be any of the f90VB string types (Fortran Strings, Fixed OLE Strings, Fortran OLE Strings or BStrings).
Comments
Function StrLenTrim is f90VB's analog to Fortran's intrinsic function len_trim().
Argument Str
When Str is a Fortran String, StrLenTrim result is equivalent to the value returned by Fortran's intrinsic function len_trim().
When Str is a Fixed OLE String, a Fortran OLE String or a BString, function StrLenTrim scans Str for the first null-terminator and returns the number of characters counted (excluding the null-terminator), or 0 if Str has not been allocated.
Note on Multibyte strings: f90VB uses Fortran Strings to store ANSI and Multibyte strings. However, in a Multibyte string, a single character may use up to two bytes of storage, which is the equivalent to two ANSI characters. When the argument passed to StrLenTrim is a Multibyte string, the function will correctly return the number of Multibyte string characters.
Examples
See example for function StrLen.
Related Topics
| For information about | See | |
| Getting the length in bytes of a string | StrByteLen | |
| Getting the length in characters of a string | StrLen | |
| Getting the trimmed length in bytes of a string | StrByteLenTrim | |