KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > parsec > CharEncoder


1 /*****************************************************************************
2  * Copyright (C) Zephyr Business Solutions Corp. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Dec 19, 2004
10  *
11  * Author Ben Yu
12  */

13 package jfun.parsec;
14
15 /**
16  * @author Ben Yu
17  *
18  * Dec 19, 2004
19  */

20 final class CharEncoder {
21   public static String JavaDoc encode(char c){
22     switch(c){
23       case ' ': return "SPACE";
24       case '\t': return "HTAB";
25       case '\r': return "CR";
26       case '\n': return "LF";
27       default: return ""+c;
28     }
29   }
30 }
31
Popular Tags