refactory: added UI removed from core plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpeclipse / wizards / html / HTMLUtilities.java
1 /*
2  * $Id: HTMLUtilities.java,v 1.2 2006-10-21 23:18:43 pombredanne Exp $
3  * Copyright Narushima Hironori. All rights reserved.
4  */
5 package net.sourceforge.phpeclipse.wizards.html;
6
7 /**
8  * 
9  */
10 public class HTMLUtilities {
11
12         final static String[] specialMarks = { "&", "&amp;", "<", "&lt;", ">",
13                         "&gt;", "\"", "&quot;", };
14
15         public static String escape(String text) {
16                 for (int i = 0; i < specialMarks.length; i += 2) {
17                         text = text.replaceAll(specialMarks[i], specialMarks[i + 1]);
18                 }
19                 return text;
20         }
21
22         public static String unescape(String text) {
23                 for (int i = specialMarks.length - 1; i >= 0; i -= 2) {
24                         text = text.replaceAll(specialMarks[i], specialMarks[i - 1]);
25                 }
26                 return text;
27         }
28
29 }