Mercurial > projects > ddmd
changeset 151:766e6dc390e1
+ Escape.escapeChar()
author | Trass3r |
---|---|
date | Wed, 15 Sep 2010 02:47:24 +0200 |
parents | a79be6756969 |
children | 4092a614a9f3 |
files | dmd/Escape.d |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/dmd/Escape.d Tue Sep 14 15:49:40 2010 +0200 +++ b/dmd/Escape.d Wed Sep 15 02:47:24 2010 +0200 @@ -2,10 +2,23 @@ struct Escape { - const(char)* strings[256]; + string[256] strings; - static const(char)* escapeChar(uint c) + /*************************************** + * Find character string to replace c with. + */ + static string escapeChar(char c) { - assert(false); + switch (c) + { + case '<': + return "<"; + case '>': + return ">"; + case '&': + return "&"; + default: + return null; + } } } \ No newline at end of file