Prototype源码浅析 String部分(一)之有关indexOf优化
添加到String.prototype中的方法比较多,不过归结起来,大致分为下面几类:分类方法名 原始能力增强strip |include|startsWith|endsWith |empty |blank格式camelize | capitalize |underscore |dasherize|
添加到String.prototype中的方法比较多,不过归结起来,大致分为下面几类:分类方法名 原始能力增强strip |include|startsWith|endsWith |empty |blank格式camelize | capitalize |underscore |dasherize|
格式camelize | capitalize |underscore |dasherize| inspect变形toArray |succ| times这里面一个有用的方法是inspect,按照参考手册的说明,他的作用是“返回该字符串针对调试的字符串表现形式(即用单引号或双引号包括起来,并使用 '
抄些常用工具方便查找 ----------字符串 Ext.util.Format.capitalize(string str);//将首字母变大写 Ext.util.Format.ellipsis(string value, Number length);//截取指定length字符,将自动在尾处添
smarty常用的20个变量操作符 * 使用语法:{变量名|操作符:} * capitalize ---首字母大写 * count_characters ---计算字符数 * cat ---连接字符串 * count_paragraphs ---计算段落数 * count_sentences ---
text-transform:uppercase //把文字变成全大写 text-transform:lowercase //把文字变成全小写 text-transform:capitalize //把文字变成首字母大写 text-indent:-9999em //图片添加文字说明但不显示在页面增强
函数较简单,看下面的例子: 实现代码如下:s = 'hEllo pYthon' print s.upper() print s.lower() print s.capitalize() print s.title() 输出结果: HELLO PYTHON hello python Hello pyt