<%@page contentType="text/html" pageEncoding="UTF-8"%> <% request.setAttribute("base", request.getContextPath()); %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>decode和encode的介绍</title> <link rel="stylesheet" type="text/css" href="${base}/ext/resources/css/ext-all.css" /> <script type="text/javascript" src="${base}/ext/ext-base.js"></script> <script type="text/javascript" src="${base}/ext/ext-all.js"></script> <script type="text/javascript" src="${base}/ext/ext-lang-zh_CN.js"></script><!--中文映射--> <script type="text/javascript"> function ready(){ //Ext.util.Format.capitalize(参数)将首字母大写 var str="abcdefghigklmn"; var after=Ext.util.Format.capitalize(str);//调用函数,将首字母转为大写 Ext.Msg.alert("",after);//输出显示Abcdefghigklmn } Ext.onReady(ready) ;//参数为定义的函数,onReady是程序的入口 </script> </head> <body> </body> </html>
?
?
?
<%@page contentType="text/html" pageEncoding="UTF-8"%> <% request.setAttribute("base", request.getContextPath()); %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>decode和encode的介绍</title> <link rel="stylesheet" type="text/css" href="${base}/ext/resources/css/ext-all.css" /> <script type="text/javascript" src="${base}/ext/ext-base.js"></script> <script type="text/javascript" src="${base}/ext/ext-all.js"></script> <script type="text/javascript" src="${base}/ext/ext-lang-zh_CN.js"></script><!--中文映射--> <script type="text/javascript"> function ready(){ //Ext.util.Format.ellipsis(参数,长度);如果 参数大于长度,将截取参数为长度的子字符串,但是最后三位为省略号
如果参数小于长度,则只截取参数本身 var str="abcdefghigklmn"; var after=Ext.util.Format.ellipsis(str,8); Ext.Msg.alert("",after);//输出显示abcde... } Ext.onReady(ready) ;//参数为定义的函数,onReady是程序的入口 </script> </head> <body> </body> </html>
?
?
?
<%@page contentType="text/html" pageEncoding="UTF-8"%> <% request.setAttribute("base", request.getContextPath()); %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>decode和encode的介绍</title> <link rel="stylesheet" type="text/css" href="${base}/ext/resources/css/ext-all.css" /> <script type="text/javascript" src="${base}/ext/ext-base.js"></script> <script type="text/javascript" src="${base}/ext/ext-all.js"></script> <script type="text/javascript" src="${base}/ext/ext-lang-zh_CN.js"></script><!--中文映射--> <script type="text/javascript"> function ready(){ //Ext.util.Format.uppercase(参数),将参数全部转化为大写 var str="abcdefghigklmn"; var after=Ext.util.Format.uppercase(str); Ext.Msg.alert("",after);//输出显示ABCDEFGHIGKLMN } Ext.onReady(ready) ;//参数为定义的函数,onReady是程序的入口 </script> </head> <body> </body> </html>
?
其他的比如:
?
Ext.util.Format.lowercase(参数);
?Ext.util.Format.substr(参数,索引位置,截取字符串的长度);
Ext.util.Format.usMoney("1000");//将字符串转为美元?? ,这里的1000只是个例子
?Ext.util.Format.trim("????????????????????????? 1000??????????????????? ");//去掉空格函数
Ext.util.Format.fileSize("1024");? //将代表字节的数据值转为文件大小的字符串
?