I'm calling a Win32 API function and getting back a string padded with null characters. Trim$()
doesn't remove them. Is there an easier solution then removing them one character at a time?
views:
21answers:
1
+1
A:
if it's just padded to the right, you can use something like this:
function ntrim(byval theString as string) as string
dim iPos as long
iPos = instr(theString, chr$(0))
if iPos > 0 then theString = left$(theString, iPos - 1)
end function
Don Dickinson
2010-07-03 05:08:50
Thanks! I'd like to think I would have come up with that if I hadn't stayed up so late writing code...
BenV
2010-07-03 14:03:54