Trim issues
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 161
- Joined: Wed Aug 02, 2006 4:30 am
Trim issues
Somebody can tell me how to get numbers and letters from such a string by trim function.
KBN12390 -> to get KBN and 12390
234BN -> to get 234 and BN.
Thanks
KBN12390 -> to get KBN and 12390
234BN -> to get 234 and BN.
Thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You could create your own parallel routine. Make sure it handles letters of both lower case and upper case if this is what your business rules require.
For small volumes you could use a BASIC Transformer stage and use the DIGITS and LETTERS Transforms.
For small volumes you could use a BASIC Transformer stage and use the DIGITS and LETTERS Transforms.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 161
- Joined: Wed Aug 02, 2006 4:30 am
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The syntax (argument order) in your Convert() function is incorrect, and this approach is not general - as Craig notes, it removes only upper case letters.
Trim() achieves nothing here.is more general, but removes only alphabetic characters.
Trim() achieves nothing here.
Code: Select all
Convert("ABCDEFGHIJKLMONPQRSTUVWXYZ", "", Upcase(InLink.TheString))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Charter Member
- Posts: 36
- Joined: Thu Jun 10, 2004 11:22 pm
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Have you written a parallel version of the Iconv() or Oconv() function that you can share with us?
If you have, an "MCA" conversion will return just the letters - no need for Ereplace().
If you have, an "MCA" conversion will return just the letters - no need for Ereplace().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54
- Joined: Wed Oct 25, 2006 11:07 pm
- Location: Hyderabad
Re: Trim issues
Why Use a trim for this, U can very well use left and right functions provided in the transaformer.
KBN12390 -> to get KBN and 12390
234BN -> to get 234 and BN.
Thanks[/quote]
KBN12390 -> to get KBN and 12390
234BN -> to get 234 and BN.
Thanks[/quote]
-
- Participant
- Posts: 161
- Joined: Wed Aug 02, 2006 4:30 am
It works in my case actually.chulett wrote:The convert, not the trim, is removing the letters for you. Does it cause any potential problems? You'd have to tell us - it only removes upper-case letters from the string, is that enough to solve your particular problem?
And also I use Convert(field, "1234567890","") to remove number as well. and it works.
Thanks
By the way, I am interested in the routine to trim Characters or numbers, anybody can post a sample code here.
Thanks
How good are your C skills? Writing a C function that will remove letters/digits is not hard. You will have to read the string, one character at a time, assign it to an integer variable which will store the character's ascii code. You can constraint ascii codes to integers and alphabets.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: