jeffrey_crowley
12 years agoContributor
aqString.Trim() is not removing nbsps as whitespace
I'm trying to trim whitespace from a string using aqString.Trim() that I pulled from an HTML element as .innerText. The problem seems to be that it contains a <space><nbsp> at the end of the string so Trim() doesn't remove the nbsp.
I can do this easily in javascript using <string>.trim() but TC doesn't seem to like it. Here's a simple example in jsFiddle. jsFiddle demo
... and here's an example of trying to use javascript's trim() in TC:
function test()
{
var s = " ABC 123 ";
Log.Message(s.trim());
}
Can anyone suggest a workaround? I'm trying not to have to search and replace nbsps, etc. Thanks.
I can do this easily in javascript using <string>.trim() but TC doesn't seem to like it. Here's a simple example in jsFiddle. jsFiddle demo
... and here's an example of trying to use javascript's trim() in TC:
function test()
{
var s = " ABC 123 ";
Log.Message(s.trim());
}
Can anyone suggest a workaround? I'm trying not to have to search and replace nbsps, etc. Thanks.