What function to use for replacing string?
Posted: Wed Feb 09, 2011 5:30 am
on a UNIX machine, with PX server (v8.01)
For example, in a field i get filePaths.
but the slashes are twins ex : "C:\\toto\\toto1\\toto2\\toto3"
in a transformerStage (on a parallel job); how can I simply replace the double slash into a simple slash like : "C:\toto\toto1\toto2\toto3"
in a transformer stage (on parallel job) , Ereplace(), change() and pxEreplace() don't work as the compiler do not recognize these functions.
For internal reasons, I can't use an external routine.
left() and right() use is not a simple solution as the number of double-slash may change.
Convert() can't work either as it replaces only one character with another only one character.
Of course there is very badly ugly solution.
In a transformer stage, I set 25 stages variables using Field() function with "\" as separator and 1 to 25 as number of occurences.
Then I can concatenate the 25 stage variables if there are not empty.
But if there is more than 13 doubles slashes (and it can happen), I'll miss a part of the filePath.
Have you got an idea ?
For example, in a field i get filePaths.
but the slashes are twins ex : "C:\\toto\\toto1\\toto2\\toto3"
in a transformerStage (on a parallel job); how can I simply replace the double slash into a simple slash like : "C:\toto\toto1\toto2\toto3"
in a transformer stage (on parallel job) , Ereplace(), change() and pxEreplace() don't work as the compiler do not recognize these functions.
For internal reasons, I can't use an external routine.
left() and right() use is not a simple solution as the number of double-slash may change.
Convert() can't work either as it replaces only one character with another only one character.
Of course there is very badly ugly solution.
In a transformer stage, I set 25 stages variables using Field() function with "\" as separator and 1 to 25 as number of occurences.
Then I can concatenate the 25 stage variables if there are not empty.
But if there is more than 13 doubles slashes (and it can happen), I'll miss a part of the filePath.
Have you got an idea ?