10 Years of Service
15%
Please note, if you want to make a deal with this user, that it is blocked.
[HIDE-THANKS]For many API functions, you have to pass a space-padded string to the function and strip the null terminator from value returned. This is the purpose of this snippet.
[/HIDE-THANKS]
Code:
>Public Function StripNull(ByVal InString As String) As String
'Input: String containing null terminator (Chr(0))
'Returns: all character before the null terminator
Dim iNull As Integer
If Len(InString) > 0 Then
iNull = InStr(InString, vbNullChar)
Select Case iNull
Case 0
StripNull = InString
Case 1
StripNull = ""
Case Else
StripNull = Left$(InString, iNull - 1)
End Select
End If
End Function