Rot-13: Difference between revisions
Content deleted Content added
Undo revision 104951 by 122.3.171.14 (talk) Vandalism |
Improved D version |
||
Line 392:
=={{header|D}}==
<lang d>import std.stdio, std.string;
<lang d>string rot13(string s) {▼
alias std.string.letters Alpha ;▼
enum Rot13 = Alpha[13..26]~Alpha[0..13]~Alpha[39..52]~Alpha[26..39] ;▼
return std.string.tr(s, Alpha, Rot13) ;▼
}</lang>▼
}
void main() {
writeln("Gur Dhvpx Oebja Sbk Whzcf Bire Gur Ynml Qbt!".rot13());
▲}</lang>
Output:
<pre>The Quick Brown Fox Jumps Over The Lazy Dog!</pre>
{{works with|D|1}}
<lang d>import std.stdio, std.string;
|