Page 1 of 1

Transformer trim question

Posted: Tue Dec 02, 2008 9:57 pm
by dscon9128
What happens when you trim('') as opposed to trim (' '), that is trim of a field without a space, and trim of a field with just a single space . I believe trim removes trailing and leading spaces, but what if i want to have just a single space intact? Will trimming remove the single space as well?

Re: Transformer trim question

Posted: Tue Dec 02, 2008 10:31 pm
by priyadarshikunal
dscon9128 wrote:What happens when you trim('') as opposed to trim (' '), that is trim of a field without a space, and trim of a field with just a single space . I believe trim removes trailing and leading spaces, but what if i want to have just a single space intact? Will trimming remove the single space as well?
single space from where? between to words or leading or trailing?

look for the different options of trim function (Basic Reference Guide), I think D and R are suitable options if you want only redundant characters to be removed.

Posted: Tue Dec 02, 2008 10:42 pm
by ray.wurlod
The default behaviour of Trim() is to remove leading, trailing and redundant consecutive trimmable characters. Therefore Trim(" ") would leave a single space character as the result.

Posted: Wed Dec 03, 2008 9:49 am
by dscon9128
ray.wurlod wrote:The default behaviour of Trim() is to remove leading, trailing and redundant consecutive trimmable characters. Therefore Trim(" ") would leave a single space character as the result. ...
Thanks a lot to both of you for your response. Basically , to restate my exact requirement, i need to trim all the fields on incoming data, before sending the data to an xml output stage. I achieve the trimming by means of using a transformer. However, some fields have a single space as the value.It is important that i maintain that single space,and hence i was just wondering if the trim function would eliminate the single space as well.
So if i understand Ray's response , trim of a single space should preserve the space intact. i.e trim(" ") =" ".

Thanks again!
Uday