Are you doing this in a JSP or a Java object? Or Sightly? Those calls return a String object, so if you aren't able to manipulate it then I'd guess it's a limitation of your scripting tool.
Assuming that this is sightly you'll probably need to use either JavaScript Use function or Java Use Bean to do the manipulation.