[ATL] Replace strange symbols [message #660731] |
Mon, 21 March 2011 08:33  |
Eclipse User |
|
|
|
Hi, I have a string property to which I want to replace some strange symbols like (ñ, ç) or accents but I have used replaceAll() method and it doesn't work fine.
that is my code:
element.name <- element.name.replaceAll('ñ', 'ny');
element.name <- element.name.replaceAll('ç', 'c');
element.name <- element.name.replaceAll('ó', 'o');
I transform elements with this symbols ('año', 'dirección'...) but the result is the same.
I have try to compare, for each character if it is a strange symbol but comparison returns false. That is:
for (c in element.name.toSequence()) {
if (c = 'ñ') {
... this code is never reached
}
}
Any idea ?¿?
|
|
|
|
|
|
|
Re: [ATL] Replace strange symbols [message #660794 is a reply to message #660731] |
Mon, 21 March 2011 12:07  |
Eclipse User |
|
|
|
Hi Miguel,
it could be an encoding problem. If what you expect to be a 'ñ' internally is represented by something like '#$%&' your replace/comparison wont work.
Miguel Ll wrote on Mon, 21 March 2011 08:33 | for (c in element.name.toSequence()) {
if (c = 'ñ') {
... this code is never reached
}
}
|
You could look in the debugger BEFORE you compare c = 'ñ' what values c takes. Maybe you have to check the encoding setting for your import. Do you use XMI? The first line of the XML should specify an encoding.
Regards,
Sebastian
|
|
|
Powered by
FUDForum. Page generated in 1.24320 seconds