`
humlzy
  • 浏览: 21501 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

积累..

阅读更多
计算字节  中文一个字符占两个字节
<script>
function checkLength(inValue, dis, bound){
    var getRealLen = function(s){
        if(typeof(s)!='string'){return 0;}
              // 去空格,中文字符占两个字节
                return s.replace(/(^\s*)|(\s*$)/g,"").replace(/[^\x00-\xFF]/g,"**").length;
     }

     if(getRealLen(inValue) > bound){
         dis.innerHTML = "<b style='color:red;'>" + getRealLen(inValue) + "</b>/" + bound;
     }else{
         dis.innerHTML = "<b>" + getRealLen(inValue) + "</b>/" + bound;
     }
    };
</script>

<table>
  <tr>
  <td>
    <textarea name="content" cols="80" rows="5"
    onkeyup="checkLength(this.value,document.all.lengthMsg,20)"></textarea>
    <div align="right"><span id="lengthMsg"><b>0</b>/20</span></div>
    </td>
  </tr>
</table>


ORACLE  字符集查看方式
1: [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0] - NLS_LANG
2: SELECT USERENV('LANGUAGE') FROM DUAL;


ORACLE  根据指定索引查询
SELECT /*+ index (a IX_DISPSHIS_ACCEPTPHONE)*/ * FROM ****



删除table某行
window.onload = function()
{
var tabObj = document.getElementById("queryListAreaContent");

for(var i = tabObj.rows.length-1; i >0 ; i--)
{
var cellText = (tabObj.rows(i).cells(0).innerText).replace(/^\s+|\s+$/g, "");

if(cellText == "" || typeof(cellText) == "undefined")
{
tabObj.rows(i).removeNode(true);
}
}
}




xml字符串格式化输出
public static String formatXML(Document document){
    // Document document = DocumentHelper.parseText(this.autoLoading());
    StringWriter writer = new StringWriter();
   
    OutputFormat format = OutputFormat.createPrettyPrint();
   
    format.setEncoding("utf-8");
   
    XMLWriter xmlWriter = new XMLWriter(writer,format);
   
    try {
    xmlWriter.write(document);
} catch (Exception e) {
e.printStackTrace();
}

return writer.toString();
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics