|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Help needed in using Trim/Substring functions |
« View previous topic :: View next topic » |
Author |
Message
|
Bharat |
Posted: Thu Aug 05, 2004 9:10 am Post subject: Help needed in using Trim/Substring functions |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
Hi,
I need to trim 5 trailing characters from a string.
My input string is: INPUT.SAMPLE.STRING.TEST
My output string should be: INPUT.SAMPLE.STRING
Just I need to strip of trailing characters '.TEST'
I'm using the following code.
Code: |
TRIM(TRAILING '.TEST' FROM InputString) |
I'm getting the following error.
Quote: |
Illegal trim character ''.TEST'' argument to TRIM function. The trim character argument to the TRIM function must be a character string, a byte string or a bit string, and must be of length 1. The trim character argument was ''.TEST''. |
How to get my output string using Trim or Substring function? I appreciate your help.
Thanks,
Bharat |
|
Back to top |
|
 |
Lisa |
Posted: Thu Aug 05, 2004 9:26 am Post subject: String |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
Set NewString = String(Input From 1 for 19);
Lisa |
|
Back to top |
|
 |
Bharat |
Posted: Thu Aug 05, 2004 9:34 am Post subject: |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
Thanks Lisa. But the initial part of the String is not constant.
For example: In INPUT.SAMPLE.STRING.TEST, the 'STRING' part varies for each input XML file. Only 'INPUT', 'SAMPLE' and 'TEST' parts are constants. So I can't use
Code: |
Set NewString = String(Input From 1 for 19); |
But '.TEST' is constant always. So is there anyway to trim the trailing characters '.TEST' from the input string.
Thanks,
Bharat |
|
Back to top |
|
 |
Lisa |
Posted: Thu Aug 05, 2004 9:44 am Post subject: String |
|
|
Master
Joined: 07 Jun 2002 Posts: 287 Location: NJ
|
Well, you could do the following.
Get Length, then substring.
Set InputLenght = Length(Input);
Set InputLength = InputLength - 5 --> ".TEST" is equal to 5
Set NewString = String(Input From 1 for InputLength);
I'm sure there are other ways of extracting this information.
Lisa |
|
Back to top |
|
 |
Bharat |
Posted: Thu Aug 05, 2004 10:34 am Post subject: |
|
|
 Acolyte
Joined: 14 May 2002 Posts: 61 Location: Reston, VA, USA
|
Your code worked for for this issue. Thank you so much Lisa. I appreciate your help.
Regards,
Bharat |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|