<-- Previous || Up || Next -->

Strip Nil Character Forward Function
String Replacements Class

Public Function StripNilCharacterForward( _
    ByVal vLine As Variant _
    ) As Variant

Strips the first Nil character (Chr$(0); the character whose ASCII value is 0 (zero)) and all following characters from a string.

Note: This function is usually used to convert fixed-length nil-terminated C strings into variable-length Visual Basic strings after the string has had its value assigned as the result of a call to an API function.
Example:
    Assuming
       Dim S As String
       S = String$(128, 0)
       Mid$(S, 1, 4) = "Test"
    for example
       S = StripNilCharacterForward(S)
    leaves
       S = "Test"
See also:
    LeftOfFirstMatch Function
vLine: The string whose trailing nil-terminated portion is to be removed. Function returns Null if vLine is Null or cannot be fixed up to a String (Behavior #1).
Return value: Function returns the string unchanged if it does not contain any Nil characters (Behavior #2).

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.