dojo.string.substituteParams |
类似C#中的String.Format函数
%{name}要保证与传入的对象的名称大小写一致,否则会出异常
Usage Example:
dojo.string.substituteParams("%{0} - %{1} - %{2}", "a", "b", "c"); //will return "a - b - c"
dojo.string.substituteParams("%{name}: %{value}", {name:"名称",value:"值"}); //will return "名称: 值" |
dojo.string.capitalize |
把每一个单词的首字母大写
Usage Example:
dojo.string.capitalize("show me love"); //will return "Show Me Love" |
dojo.string.isBlank |
判断输入字符串是否为空或全是空白字符,如果传入对象为非字符串则也会返回true
Usage Example:
dojo.string.isBlank(" 1 "); //will return false |
dojo.string.escape |
参数1为type,可传值为: xml/html/xhtml, sql, regexp/regex, javas cript/js cript/js, ascii
将按照所传type对字符串进行编码
Usage Example:
dojo.string.escape("html", "<input type='text' value='' />"); //will return "<input
type='text' value='' />"
dojo.string.encodeAscii
dojo.string.escapeXml
dojo.string.escapeSql
dojo.string.escapeRegExp
dojo.string.escapeJavas cript
dojo.string.escapeString
这些函数也就是 dojo.string.escape 所调用的,这里无需多说 |
dojo.string.summary |
取得输入字符串的缩略版本
Usage Example:
dojo.string.summary("1234567890", 5); //will return "12345..." |
dojo.string.endsWith |
判断输入字符串是否以指定的字符串结尾
Usage Example:
dojo.string.endsWith("abcde", "E"); //will return false
dojo.string.endsWith("abcde", "E", true); //will return true |
dojo.string.endsWithAny |
判断输入字符串是否以指定的任意字符串结尾
Usage Example:
dojo.string.endsWithAny("abcde", "E", "e"); //will return true |
dojo.string.startsWith |
判断输入字符串是否以指定的字符串开头
Usage Example:
dojo.string.startsWith("abcde", "A"); //will return false
dojo.string.startsWith("abcde", "A", true); //will return true |
dojo.string.startsWithAny |
判断输入字符串是否以指定的任意字符串开头
Usage Example:
dojo.string.startsWithAny("abcde", "A", "a"); //will return true |
dojo.string.has |
判断输入字符串是否含有任意指定的字符串
Usage Example:
dojo.string.has("abcde", "1", "23", "abc"); //will return true |
dojo.string.normalizeNewlines |
按要求转换回车换行的格式
Usage Example:
dojo.string.normalizeNewlines("a\r\nb\r\n", "\r"); //will return "a\rb\r" |
dojo.string.splitEscaped |
将字符串按分隔符转换为数组
Usage Example:
dojo.string.splitEscaped("a\\_b_c", '_'); //will return ["a\\_b", "c"] |