Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" (ByVal lpString As Any) As Long
lstrlen determines the length of a string. The length of a string is considered to be the number of characters it contains, not counting any possible terminating null character. This function can also determine the length of a string to which a pointer refers.
The function returns the length of the string, measured in number of characters.
This function is very useful, in conjunction with lstrcpy, for "converting" a pointer to a string into an actual string.
' Display the length of the string "Hello, world!"
Dim slength As Long ' receives the length of the string
slength = lstrlen("Hello, world!") ' find the length of the string
Debug.Print "The string 'Hello, world!' contains"; slength; "characters."
Last Modified: December 21, 1999
This page is copyright © 1999 Paul Kuliniewicz. Copyright Information