Click to See Complete Forum and Search --> : how to remove new line character


svsameer
03-31-2005, 12:33 AM
i am having following line in my asp file where in the value from databse appeares in text editor window..
writeRichText('rte1', '<%=trim(comp_name)%>', 350, 40, true, false);

this workes fine in IE but in mozilla a space or new line character comes before and after the varialbe which results in javascript error

how to remove the new line character..
i hv tried trim() but it dident worked
how to remove it
Sameer

phpnovice
03-31-2005, 12:51 AM
You'll need to pre-process your variable:

If Left(comp_name,1) = vbCr _
Or Left(comp_name,1) = vbLf Then
comp_name = Mid(comp_name,2)
End If
If Left(comp_name,1) = vbCr _
Or Left(comp_name,1) = vbLf Then
comp_name = Mid(comp_name,2)
End If
If Right(comp_name,1) = vbCr _
Or Right(comp_name,1) = vbLf Then
comp_name = Mid(comp_name,1,Len(comp_name - 1))
End If
If Right(comp_name,1) = vbCr _
Or Right(comp_name,1) = vbLf Then
comp_name = Mid(comp_name,1,Len(comp_name - 1))
End If