How to Strip the Null Terminator from a given String
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 'String Manipulation - How to Strip the Null Terminator from a given String Option Explicit Public Function StripNull(ByVal sExpression As String) As String 'Input: String containing null terminator ( chr ( 0 ) ) 'Returns: all character before the null terminator Dim iNullChar As Integer If Len(sExpression) > 0 Then iNullChar = InStr(sExpression, vbNullChar) Select Case iNullChar Case 0 StripNull = sExpression Case 1 StripNull = "" Case Else StripNull = Left$(sExpression, iNullChar - 1) End Select End If End Function |
Related posts:
- How to Strip/Remove Text from a given String
- How to Strip special characters from a given String
- How to Strip Numeric from a string
- How to Strip Alphabets from a string
- How to check whether given string is numeric or not without using IsNumeric function.
- How to Remove all Non Alpha Numeric characters from a given string
- How to Strip Non Alpha Numeric from a string
- How to check if a string contains only Alphabetical Characters
- How to check if a string contains only Numeric Characters
- How to return everything between ’string2′ in ’string1′