> -----Original Message-----
> From: Kelly Jones [mailto:[email protected]]
> Sent: Friday, April 10, 2009 13:33
> To: [email protected]
> Subject: Replace string with list of strings via character changes
>
> I want to replace all the o's in a string with x's or y's and all the
> a's in a string with u's or v's.
>
> Example: given string "foobar", the output would be this list
> of strings
>
> fxxbur (change both o's to x, and the a to u)
> fxxbvr (both o's to x, a to y)
> fxybur (first o to x, second to y, and the a to u)
> fxybvr (and so on...)
> fyxbur
> fyxbvr
> fyybur
> fyybvr
I am not following at all given what you state you want to do,
then in your example you have something else and then add in ( and so
on... ).
Do you want to change o's to x one time and y the next and a to
u then y the next time?????
Wags ;)
David R. Wagner
Senior Programmer Analyst
FedEx Freight
1.719.484.2097 TEL
1.719.484.2419 FAX
1.408.623.5963 Cell
http://fedex.com/us
>
> What's the best subroutine to do this? I've got some ideas, but
> they're all fairly complex.
>
> Reason I'm doing this (if anyone cares): I want to ASCII-ify the
> geonames alternatenames table using iso-8859-1. Most of the
> translations are obvious:
>
> s/[\xc0-\xc5]/A/sg;
> s/\xc6/AE/sg;
> s/\xc7/C/sg;
> s/[\xc8-\xcb]/E/sg;
> s/[\xcc-\xcf]/I/sg;
> s/\xd1/N/sg;
> s/[\xd2-\xd6\xd8]/O/sg;
> s/[\xd9-\xdc]/U/sg;
> s/\xdd/Y/sg;
> s/[\xe0-\xe5]/a/sg;
> s/\xe6/ae/sg;
> s/\xe7/c/sg;
> s/[\xe8-\xeb]/e/sg;
> s/[\xec-\xef]/i/sg;
> s/\xf1/n/sg;
> s/[\xf2-\xf6\xf8]/o/sg;
> s/[\xf9-\xfc]/u/sg;
> s/[\xfd\xff]/y/sg;
>
> but "eth" can be translated as "d" or "dh", "thorn" can be translated
> as "th" or "y", and "sharp s" can be translated as "ss" or "sz".
>
> In all cases, I want to use *both* translations to have the largest
> possible ASCII-ification.
>
> --
> We're just a Bunch Of Regular Guys, a collective group that's trying
> to understand and assimilate technology. We feel that resistance to
> new ideas and technology is unwise and ultimately futile.
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/