how to replace special characters with N in a string
Moderators: chulett, rschirm, roy
how to replace special characters with N in a string
hi all
i have a string in which there are some special characters ,those need to be replace with N
any help would be greatly appreciated
i have a string in which there are some special characters ,those need to be replace with N
any help would be greatly appreciated
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
Re: how to replace special characters with N in a string
You can use the Convert function in a Transformer stage.
Syntax:
convert('From List','To List','Expression')
In From List, you can specify the list of special characters that needs to be replaced
In To List, you can specify the list of new characters that will replace the special chars. In your case it will 'N'.
In Expression, you can give the column name.
e.g
Convert('$,@,!,%,#','N,N,N,N,N', DSLink3.SPEC_CHAR)
Note:
This method is good if you have a small set of special characters to be replaced. Else the 'From List' will be too long.
Syntax:
convert('From List','To List','Expression')
In From List, you can specify the list of special characters that needs to be replaced
In To List, you can specify the list of new characters that will replace the special chars. In your case it will 'N'.
In Expression, you can give the column name.
e.g
Convert('$,@,!,%,#','N,N,N,N,N', DSLink3.SPEC_CHAR)
Note:
This method is good if you have a small set of special characters to be replaced. Else the 'From List' will be too long.
The correct syntax for Convert would actually be:
No commas... unless you want those replaced as well... with another comma.
I'd still like to see examples of these 'special characters' before people go too crazy with the suggestions...
Edited to add: Ack, am I in the PX forum? Dang. That's technically a Server answer so the PX syntax may very well require commas. If that's the case, my bad..
Code: Select all
Convert('$@!%#','NNNNN', DSLink3.SPEC_CHAR)
I'd still like to see examples of these 'special characters' before people go too crazy with the suggestions...
Edited to add: Ack, am I in the PX forum? Dang. That's technically a Server answer so the PX syntax may very well require commas. If that's the case, my bad..
Last edited by chulett on Thu Oct 26, 2006 5:42 pm, edited 1 time in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Charter Member
- Posts: 199
- Joined: Tue Jan 18, 2005 2:50 am
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Because, as I noted, you are telling it to replace all commas in the string with yet another comma, so it just looks like it works fine. Check the examples in the online help.
It's certainly not a fatal problem, just wastes cycles. It's not all that different from telling it to replace all 'X' characters with an 'X'.
It's certainly not a fatal problem, just wastes cycles. It's not all that different from telling it to replace all 'X' characters with an 'X'.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers