Author |
Message
|
dan2WMB |
Posted: Mon Dec 06, 2010 5:28 am Post subject: Trimming "tab" character in ESQL |
|
|
Novice
Joined: 06 Aug 2010 Posts: 12
|
I am trying to use ESQL TRIM() function to trim white spaces in a string.It is working for trimming leading and trailing white spaces, but not for "tab" character. How to trim a string containing "tab" character in its leading/trailing end? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 06, 2010 5:30 am Post subject: Re: Trimming "tab" character in ESQL |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
dan2WMB wrote: |
How to trim a string containing "tab" character in its leading/trailing end? |
SUBSTRING & TRANSLATE are always popular choices for this kind of task. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
dan2WMB |
Posted: Mon Dec 06, 2010 6:07 am Post subject: |
|
|
Novice
Joined: 06 Aug 2010 Posts: 12
|
Thanks for your reply, Vitor.
Could you please tell me how to find a "tab" character in a string? we can use POSITION() function for this.But how to specify the "tab" character in the search parameter? Do we need to mention ASCII value of "tab" character in that function? |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 06, 2010 6:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
dan2WMB wrote: |
we can use POSITION() function for this.But how to specify the "tab" character in the search parameter? |
POSITION is an unnecessary step. Use SUBSTRING AFTER. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
dan2WMB |
Posted: Mon Dec 06, 2010 6:24 am Post subject: |
|
|
Novice
Joined: 06 Aug 2010 Posts: 12
|
Do we have SUBSTRING AFTER function in ESQL? I thought we have only SUBSTRING function. How to find a "tab" character in a string? |
|
Back to top |
|
 |
dan2WMB |
Posted: Mon Dec 06, 2010 6:27 am Post subject: |
|
|
Novice
Joined: 06 Aug 2010 Posts: 12
|
Sorry. i found how to use SUBSTRING AFTER. Please help me to find a "tab" character in a string. |
|
Back to top |
|
 |
mgk |
Posted: Mon Dec 06, 2010 7:05 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Try:
Code: |
DECLARE tab CAST(X'09' AS CHARACTER CCSID 1208);
DECLARE result CHARACTER TRIM( tab FROM myInputString ); |
Kind Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|