Iam Currently Using WM:Public:String.trim function in our developemnt but the Strange thing is it trim frist and last spaces only what happend to the middle spaces. for Example Iam giving input to the string like “Raj kanth” my desire output is “Rajkanth” but it is coming as it is.
other than Java custom code any alternative Solution and One more question why trim is taking first and last spaces only.
Thanks in Advance
Regards
Sreekanth
Trim is designed to remove only leading and trailing white space. To remove all spaces you would need to use the pub.string:replace service to replace spaces with nothing. Thanks,
trim also eliminates carriage returns or some hidden character that you normally can’t see on a text editor. useful when processing flat files or tokenizing stuff…
So, I need your help. In my case, When I am generating a flatfile and is stored on some location. When I open it. the records are not aligned properly. I am using newline as new record. Can you please tell the solution to get the file records aligned properly.
I have document- inside have StringList. while trimming i am not able to replace trimmed value with old value. Could you please help here.
Regards
Hariom
Hi Hariom,
Are you saying you want to trim the document/StringList for temporary use, but not actually change permanently? Can you clarify what is meant by “replace trimmed value with old value”?
Thanks,
Mary
To accomplish this with wM flow, you can loop over the document/stringList, invoking the pub.string:trim service, appending the output value from that to a new string list, and then (outside the loop) map the new string list to document/stringList.
when looping over the string list you can just map the output of the trim service back to the field from which you have mapped the input of the trim service.
Might be a task for a Map-Step with using the trim-service as a transformer inside the loop.
This avoids the building up of a new StringList, as addToList can become expensive depending on the size of the list.