[Mono-list] System.Text.RegularExpression question
Thu, 15 Apr 2004 15:52:43 -0700
Short and sweet: Does C# have a way to transpose letters?
I'm new to C# and as a learning tool, I'm trying to convert an old
cryptogram generator I wrote in perl. I converted the same program
in Python when I was learning some Python.
The Perl code had one line in it that I can't find in C#. The line is
similar to the following...
$text =~ tr/ABC/XYZ/;
...except it is the full alphabet tranposed to the full alphabet
randomly shuffled. It should replace each instance of 'A' with 'X',
each instance of 'B' with 'Y', etc.
The documentation at http://www.go-mono.com:8080/ says "To be added"
when looking up System.Text.RegularExpressions.Regex.
I realize I can run a loop and perform a Regex.Replace on each letter,
but thought there might be a better way.
Or maybe C# has a String.Translate method similar to Python?
Thanks for any help.