moellert
asked on
How to get rid of spaces in a string (seams Trim$ does not work)?
I am using the following code:
Dim value As System.Text.Encoding
value = System.Text.Encoding.Defau lt
Dim d111 As Byte()
d111 = value.GetBytes(adminuserna me_enc)
Dim d22(133) As Byte
NFuseEncode(d111, d111.Length, d22)
Dim s11 As String
s11 = Trim$(value.GetString(d22) )
Print(a, "Adm-Username=" & s11)
NFuseEncode is taken from a seperate .dll. No need to think about.
As you can see the variable "d22" is a 133 characters long byte. When passing this in the string "s11" the output is always "Adm-Username=xxxx " with 133 - xxxx spaces at teh end.
I thought the Trim$ or RTrim$ function would kill all spaces but thats not working.
How do I get rid of all spaces at the of "s11"?
Dim value As System.Text.Encoding
value = System.Text.Encoding.Defau
Dim d111 As Byte()
d111 = value.GetBytes(adminuserna
Dim d22(133) As Byte
NFuseEncode(d111, d111.Length, d22)
Dim s11 As String
s11 = Trim$(value.GetString(d22)
Print(a, "Adm-Username=" & s11)
NFuseEncode is taken from a seperate .dll. No need to think about.
As you can see the variable "d22" is a 133 characters long byte. When passing this in the string "s11" the output is always "Adm-Username=xxxx " with 133 - xxxx spaces at teh end.
I thought the Trim$ or RTrim$ function would kill all spaces but thats not working.
How do I get rid of all spaces at the of "s11"?
ASKER
neither works
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did the trick.
I was Replace (s11, Char(0),"")
I was Replace (s11, Char(0),"")
s11 = value.GetString(d22).Trim
s11 = Replace(value.GetString(d2