|
-
Aug 28th, 2001, 11:24 AM
#1
Thread Starter
Hyperactive Member
Is there a command to remove Null Chars from the end of a string?
I need somthning to remove the null characters from the end of my string kinda like the r trim for spaces. thanks
-
Aug 28th, 2001, 11:30 AM
#2
Fanatic Member
VB Code:
Public Function StripNulls(OriginalStr As String) As String
If (InStr(OriginalStr, Chr(0)) > 0) Then
OriginalStr = Left(OriginalStr, InStr(OriginalStr, Chr(0)) - 1)
End If
StripNulls = OriginalStr
End Function
-
Aug 28th, 2001, 11:30 AM
#3
This should do the trick I believe
Code:
Do Until Asc(Right(strName, 1)) <> 0
strName = Left(strName, Len(strName) - 1)
DoEvents
Loop
-
Aug 28th, 2001, 11:31 AM
#4
Addicted Member
You could check for the null characters at the end then do a
VB Code:
Left(variable, Len(variable) - Number Of Null Characters)
Something like that anyway...
poooof
Wizard Since 1997    
SQL Server 7.0:2K, Oracle, VB 6.0 EE, VBScript, C/C++, COBOL, RPG ILE, HTML, XML, Perl
-
Aug 28th, 2001, 11:52 AM
#5
Fanatic Member
Code:
Temp = Replace(variable, Chr(0), "")
Last edited by ExcalibursZone; Aug 28th, 2001 at 11:56 AM.
-Excalibur
-
Aug 29th, 2001, 11:43 AM
#6
Addicted Member
Hey,
Nice solution!

-mort
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|