Mercurial Hosting > luan
view core/src/luan/modules/HtmlLuan.java @ 302:2f8938fc518c
fix modules Binary and Html
git-svn-id: https://luan-java.googlecode.com/svn/trunk@303 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 18 Dec 2014 04:56:30 +0000 |
parents | ec016471c6eb |
children | 4fe6c9fed486 |
line wrap: on
line source
package luan.modules; import luan.Luan; import luan.LuanState; import luan.LuanTable; import luan.LuanFunction; import luan.LuanException; public final class HtmlLuan { public static String encode(String s) { char[] a = s.toCharArray(); StringBuilder buf = new StringBuilder(); for( int i=0; i<a.length; i++ ) { char c = a[i]; switch(c) { case '&': buf.append("&"); break; case '<': buf.append("<"); break; case '>': buf.append(">"); break; case '"': buf.append("""); break; default: buf.append(c); } } return buf.toString(); } }