|
-
Sep 8th, 2002, 10:41 PM
#1
Thread Starter
Hyperactive Member
Stripnulls Explanation
VB Code:
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
Ok, I know what that does, but I'm not so familiar with string functions, so... how does it work... and why do I get nulls from c++ but I can't add nulls to a string? like:
VB Code:
for I = 0 to 10
stringname = stringname & null (or vbNull?)
next i
Last edited by Knowledge_is_Et; Sep 8th, 2002 at 10:47 PM.
Now returning to the world of VB. Please make sure your seatbelts are securely fastened and all trays are in their upright and locked position.
-
Sep 8th, 2002, 10:50 PM
#2
PowerPoster
adding vbNull to the end of the string should add a null character to it. If it doesn't work, you can always use Chr(0), which is the ASCII for null. That StripNulls function looks like it is cutting off the whole string after the first null it incounters.
-
Sep 8th, 2002, 10:51 PM
#3
Fanatic Member
Re: Stripnulls Explanation
VB Code:
for I = 0 to 10
stringname = stringname & null (or vbNull?)
next i
[/B]
if the stringname is a string datatype how will it help u cannot add null to string variables.
if u need blank spaces u can use " " or space() function
-
Sep 8th, 2002, 11:04 PM
#4
Thread Starter
Hyperactive Member
No, I was just trying that to see if a function worked, but it seemed to never add the nulls, and I was wondering why VB (if it won't let me add nulls) was just cutting them of, in which case why it wouldn't do it when returned from a API.
Thank you both!
Now returning to the world of VB. Please make sure your seatbelts are securely fastened and all trays are in their upright and locked position.
-
Sep 8th, 2002, 11:13 PM
#5
The picture isn't missing
vbNull <> vbNullString
use VBNULLSTRING instead of VBNULL
Remember, if someone's post was not helpful, you can always rate their post negatively  .
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
|