Function to Replace a string with replacement string ?
Moderators: chulett, rschirm, roy
Function to Replace a string with replacement string ?
Do we have a function in Parallel jobs to replace every occurrence of a string with replacement string?
Example:
Replace "ABC" with "PQR"
Input String: ABCXYZABC
Output String: PQRXYZPQR
Example:
Replace "ABC" with "PQR"
Input String: ABCXYZABC
Output String: PQRXYZPQR
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Not unless you create one.
You could, of course, use a BASIC Transformer stage, which would give you access to the Ereplace() and Change() functions, but these are not natively available in parallel jobs (Modify or parallel Transformer stage).
You could, of course, use a BASIC Transformer stage, which would give you access to the Ereplace() and Change() functions, but these are not natively available in parallel jobs (Modify or parallel Transformer stage).
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.
EREPLACE() is not present in PX ??? I cant remember. I know Convert() function is present. Otherwise its not hard to write a C routine to do this.
string.h library in C has a lot of string functions. You can google it up.
string.h library in C has a lot of string functions. You can google it up.
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:
We should have a function similar to Ereplace in Parallel jobs too .. !
So there are two options to implement it:
1. Use Basic transformer in Parallel job.
2. Write a parallel rouitne in C to accomplish the same.
Option 1, Basic transformer will slow down the performance of parallel job, If I am not wrong.
Option 2, Dont have idea on writing parallel routines. Please provide inputs on how to create a parallel routine?
Thanks
Bandish
So there are two options to implement it:
1. Use Basic transformer in Parallel job.
2. Write a parallel rouitne in C to accomplish the same.
Option 1, Basic transformer will slow down the performance of parallel job, If I am not wrong.
Option 2, Dont have idea on writing parallel routines. Please provide inputs on how to create a parallel routine?
Thanks
Bandish
How about if you input is "ABCXYZABCA"
Even if the A that present in the last need to be convert to the corresponding caracter decode value, Convert() as mentioned by DSguru2B will be suitable.
I wish there should be a way to count the total number of presence of the substring using Count() and loop through the count and find the starting position using Index() and replace the given string.
Even if the A that present in the last need to be convert to the corresponding caracter decode value, Convert() as mentioned by DSguru2B will be suitable.
I wish there should be a way to count the total number of presence of the substring using Count() and loop through the count and find the starting position using Index() and replace the given string.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Or as mentioned, google for the C code. http://www.planet-source-code.com/vb/sc ... 0&lngWId=3
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That particular code is a horrible example of C code, as the comments following it indicate. Further, it replaces only the first instance.kumar_s wrote:Or as mentioned, google for the C code. http://www.planet-source-code.com/vb/sc ... 0&lngWId=3
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.