📄 utility.java
字号:
package com.xmspk.ebp.comm;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: Apr 29, 2003
* Time: 4:28:05 PM
* Author: hjl
* To change this template use Options | File Templates.
*/
public class Utility {
public Utility(){
}
// use to convert null to "" showing utility
public String Covert(Object o)
{
String str = new String();
if (o==null){
str = "";
return str;
}
else
return o.toString();
}
//use to show special character in character
public static String Encode(String source)
{
if(source == null)
return "";
StringBuffer buf = new StringBuffer(source);
char c = '\0';
int i = 0;
int j = 0;
for(int len = source.length(); j < len;)
{
c = source.charAt(j);
j++;
if(c == '&')
{
buf.insert(i, "&");
buf.setCharAt(i + 4, ';');
i += 5;
} else
if(c == '\n')
{
buf.insert(i, "<br");
buf.setCharAt(i + 3, '>');
i += 4;
} else
if(c == '<')
{
buf.insert(i, "<");
buf.setCharAt(i + 3, ';');
i += 4;
} else
if(c == '>')
{
buf.insert(i, ">");
buf.setCharAt(i + 3, ';');
i += 4;
} else
if(c == '"')
{
buf.insert(i, """);
buf.setCharAt(i + 5, ';');
i += 6;
} else
{
i++;
}
}
return buf.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -