Replacing ' with '
Moderators: chulett, rschirm, roy
Replacing ' with '
Hi,
We have a requirement to generate xml o/p and replace special chars as below,
& with &
\ with "
' with '
> with >
< with <
" with "
I have used a Basic transformer and Ereplace() function . But not able to handle apostrophe/single quote replacement through this.
Ereplace(Input_Str,''',''',0) or Ereplace(Input_Str,'\'',''',0) is not accepted. How can I replace this special char ?
Please suggest!
Thanks,
Ankita
We have a requirement to generate xml o/p and replace special chars as below,
& with &
\ with "
' with '
> with >
< with <
" with "
I have used a Basic transformer and Ereplace() function . But not able to handle apostrophe/single quote replacement through this.
Ereplace(Input_Str,''',''',0) or Ereplace(Input_Str,'\'',''',0) is not accepted. How can I replace this special char ?
Please suggest!
Thanks,
Ankita
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
DataStage BASIC expressions recognize three quote characters. If you need to quote a single-quote character surround it with either of the others. Therefore you can represent a single quote as "'" or as \'\. Hence, for example, or
Code: Select all
Ereplace(Input_Str, "'", "'", -1, 0)
Code: Select all
Ereplace(Input_Str, \'\, \'\, -1, 0)
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.
Anika,
and don't forget to change also all Charactes with Ascii-Value above 159 with
and don't forget to change also all Charactes with Ascii-Value above 159 with
Ignore the blanks I have made, but if I would not have done you would see it not correct here in the forum.= ASCII(160) => & # 1 6 0 ;
¡ = ASCII(161) => & # 1 6 1 ;
¢ = ASCII(162) => & # 1 6 2 ;
£ = ASCII(163) => & # 1 6 3 ;
¤ = ASCII(164) => & # 1 6 4 ;
¥ = ASCII(165) => & # 1 6 5 ;
¦ = ASCII(166) => & # 1 6 6 ;
§ = ASCII(167) => & # 1 6 7 ;
¨ = ASCII(168) => & # 1 6 8 ;
© = ASCII(169) => & # 1 6 9 ;
ª = ASCII(170) => & # 1 7 0 ;
« = ASCII(171) => & # 1 7 1 ;
¬ = ASCII(172) => & # 1 7 2 ;
and so on.............
Wolfgang Hürter
Amsterdam
Amsterdam
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Fine... be that way. Still, my point stands. The XML Output stage will do all of the conversions the OP asked for automatically. Well, except for "\ with "" which I assumed was a typo.
Perhaps they are doing all of their XML work manually for speed, that I could understand.
Perhaps they are doing all of their XML work manually for speed, that I could understand.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers