文本区域 换符号
来源:互联网 发布:网吧服务器攻击软件 编辑:程序博客网 时间:2024/04/29 20:22
public static String Replace(String str_source,String str_original,String str_new) {
if(str_source == null)
return null;
StringBuffer output = new StringBuffer();
int lengOfsource = str_source.length();
int lengOfold = str_original.length();
int posStart = 0;
int pos;
while((pos = str_source.indexOf(str_original,posStart)) >= 0) {
output.append(str_source.substring(posStart,pos));
output.append(str_new);
posStart = pos + lengOfold;
}
if(posStart < lengOfsource) {
output.append(str_source.substring(posStart));
}
return output.toString();
}
public static String toHtml(String s)
{
s = Replace(s,"<","<");
s = Replace(s,">",">");
s = Replace(s,"&","&");
s = Replace(s,"/t"," ");
s = Replace(s,"/r/n","/n");
s = Replace(s,"/n","<br />");
s = Replace(s," "," ");
s = Replace(s,"'","'");
s = Replace(s,"//","\");
return s;
}
public static String unHtml(String s)
{
s = Replace(s," "," ");
s = Replace(s,"<br>","/n");
return s;
}
使用如下:
<textarea rows="6" cols="45" id="content" >we have a long way to go</textarea>
toHtml("we have a long way to go");
- 文本区域 换符号
- [函数与公式] 如何合计单元格区域中带文本符号的数值?
- mser处理文本区域
- 换:换某个文本 为 另一个文本 20140621
- js鼠标获取区域文本
- GDI+计算文本矩形区域
- 给Visual studio 换编辑器文本编辑器换背景颜色
- angular2实现文本每秒换一次颜色
- 点击文本区域背景色改变
- android根据区域高度分割文本问题
- 键盘弹出时,遮挡文本输入区域
- eclipse在选定区域范围内替换文本
- JavaSwing_2.8: JTextArea(文本区域)
- python实现去除文本中的中文符号和英文符号
- ArcGIS教程:利用ArcGIS创建文本符号
- Read_text读取长文本有&符号
- jQuery - 综合实例 - 文本输入区域与标签自动更换
- Window Mobile 精确获取文本绘制区域大小
- Delphi控制摄像头
- 忆龙2009:Brew FAQ-常见问答(3)
- MINIX源码
- MTK:IDLE输入超长号码显示变化 转)
- 数据结构 c# 字符串的处理
- 文本区域 换符号
- linux下内存管理简介
- 大数据量的处理
- 忆龙2009:Brew FAQ-常见问答(2)
- 谈话节目点播
- office 2010 安装,提示无法打开注册表项 error 1402
- 忆龙2009:Brew FAQ-常见问答(1)
- CUDA起点
- 树操作的简便过程