|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
REPLACE anything that is not equal to this |
« View previous topic :: View next topic » |
Author |
Message
|
inMo |
Posted: Tue Sep 29, 2015 7:38 am Post subject: REPLACE anything that is not equal to this |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
In simple terms, ESQL REPLACE says "go replace 'this' with 'that'".
Is there a way in ESQL to state "go REPLACE anything that is NOT 'this' with 'that'"? Further, is there a way to state "go REPALCE anything that is not 'these' with 'that'"? |
|
Back to top |
|
 |
timber |
Posted: Tue Sep 29, 2015 8:20 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
English is not a great language for expressing complex technical requirements. Can we have some examples, please? |
|
Back to top |
|
 |
inMo |
Posted: Tue Sep 29, 2015 9:10 am Post subject: |
|
|
 Master
Joined: 27 Jun 2009 Posts: 216 Location: NY
|
Normal behavior
Code: |
REPLACE('ABCDABCDABCDA', 'A', 'Z')
-- RESULT = ZBCDZBCDZBCDZ
|
Exploring the idea of how to accomplish the following in ESQL using the simplest approach possible
Code: |
REPLACE('ABCDABCDABCDA', NOT 'A', 'Z')
-- RESULT = AZZZAZZZAZZZA
|
More Examples
Code: |
REPLACE('ABCDEFGGFEDCBA', NOT 'A', '-')
-- RESULT = A------------A
|
Code: |
REPLACE('ABCDEFGGFEDCBA', NOT 'A' OR 'D', '-')
-- RESULT = A--D------D--A
|
|
|
Back to top |
|
 |
timber |
Posted: Tue Sep 29, 2015 10:16 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
What's the underlying requirement? Validation? Cleansing of data? |
|
Back to top |
|
 |
maurito |
Posted: Wed Sep 30, 2015 4:21 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
if the question is: Is there an ESQL string manipulation function to do that ?
The answer is NO.
You can achieve that with a for loop, write your own function. |
|
Back to top |
|
 |
maurito |
Posted: Wed Sep 30, 2015 4:26 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
inMo wrote: |
Code: |
REPLACE('ABCDEFGGFEDCBA', NOT 'A' OR 'D', '-')
-- RESULT = A--D------D--A
|
|
you probably mean:
Code: |
REPLACE('ABCDEFGGFEDCBA', NOT ('A' OR 'D'), '-')
-- RESULT = A--D------D--A
|
or
Code: |
REPLACE('ABCDEFGGFEDCBA', NOT 'A' AND NOT 'D'), '-')
-- RESULT = A--D------D--A
|
|
|
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
|
|
|
|