text: (window.webpackJsonp=window.webpackJsonp||[]).push([[164],{616:function(t,a,e){"use strict";e.r(a);var s=e(25),v=Object(s.a)({},(function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("h1",{attrs:{id:"string-字符"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#string-字符"}},[t._v("#")]),t._v(" "),e("H2Icon"),t._v(" String 字符")],1),t._v(" "),e("h2",{attrs:{id:"tostring"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#tostring"}},[t._v("#")]),t._v(" toString")]),t._v(" "),e("p",[e("code",[t._v("toString()")]),t._v(" 同 "),e("code",[t._v("String")]),t._v(" 对象中 "),e("code",[t._v("toString")]),t._v(" 方法。")]),t._v(" "),e("h3",{attrs:{id:"语法"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.toString(targetString)\n")])])]),e("h4",{attrs:{id:"参数"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 转换的字符串；")])]),t._v(" "),e("h2",{attrs:{id:"valueof"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#valueof"}},[t._v("#")]),t._v(" valueOf")]),t._v(" "),e("p",[e("code",[t._v("valueOf()")]),t._v(" 同 "),e("code",[t._v("String")]),t._v(" 对象中 "),e("code",[t._v("valueOf")]),t._v(" 方法。")]),t._v(" "),e("h3",{attrs:{id:"语法-2"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-2"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.valueOf(targetString)\n")])])]),e("h4",{attrs:{id:"参数-2"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-2"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 转换的字符串；")])]),t._v(" "),e("h2",{attrs:{id:"charat"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#charat"}},[t._v("#")]),t._v(" charAt")]),t._v(" "),e("p",[e("code",[t._v("charAt()")]),t._v(" 同 "),e("code",[t._v("String")]),t._v(" 对象中 "),e("code",[t._v("charAt")]),t._v(" 方法。")]),t._v(" "),e("h3",{attrs:{id:"语法-3"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-3"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.charAt(targetString, index)\n")])])]),e("h4",{attrs:{id:"参数-3"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-3"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 查找的字符串；")]),t._v(" "),e("li",[e("code",[t._v("index")]),t._v(": 返回指定字符的位置")])]),t._v(" "),e("h2",{attrs:{id:"indexof"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#indexof"}},[t._v("#")]),t._v(" indexOf")]),t._v(" "),e("p",[e("code",[t._v("indexOf()")]),t._v(" 同 "),e("code",[t._v("String")]),t._v(" 对象中 "),e("code",[t._v("indexOf")]),t._v(" 方法。")]),t._v(" "),e("h3",{attrs:{id:"语法-4"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-4"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.indexOf(targetString,searchValue,fromIndex)\n")])])]),e("h4",{attrs:{id:"参数-4"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-4"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 在该字符串中查找；")]),t._v(" "),e("li",[e("code",[t._v("searchValue")]),t._v(": 被查找的值，若找到该值，返回所在索引，若未找到该值，则返回-1；")]),t._v(" "),e("li",[e("code",[t._v("fromIndex")]),t._v(" : 开始查找的位置，可以是任意整数，默认值为 0。")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("注意")]),t._v(" "),e("p",[e("code",[t._v("indexOf")]),t._v(" 方法区分大小写")])]),t._v(" "),e("h2",{attrs:{id:"lastindexof"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#lastindexof"}},[t._v("#")]),t._v(" lastIndexOf")]),t._v(" "),e("h3",{attrs:{id:"语法-5"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-5"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.lastIndexOf(targetString,searchValue,fromIndex)\n")])])]),e("h4",{attrs:{id:"参数-5"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-5"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 在该字符串中查找；")]),t._v(" "),e("li",[e("code",[t._v("searchValue")]),t._v(": 被查找的值，返回该值最后出现的位置的索引，若未找到该值，则返回-1；")]),t._v(" "),e("li",[e("code",[t._v("fromIndex")]),t._v(" : 开始查找的位置，可以是任意整数，默认值为 "),e("code",[t._v("targetString.length")]),t._v("。")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("注意")]),t._v(" "),e("p",[e("code",[t._v("lastIndexOf")]),t._v(" 方法区分大小写")])]),t._v(" "),e("h2",{attrs:{id:"slice"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#slice"}},[t._v("#")]),t._v(" slice")]),t._v(" "),e("blockquote",[e("p",[t._v("slice()方法提取一个字符串的一部分，并返回一新的字符串。")])]),t._v(" "),e("h3",{attrs:{id:"语法-6"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-6"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.slice(targetString,beginSlice,endSlice)\n")])])]),e("h4",{attrs:{id:"参数-6"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-6"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 在该字符串中查找；")]),t._v(" "),e("li",[e("code",[t._v("beginSlice")]),t._v(": 从该索引（以 0 为基数）处开始提取原字符串中的字符。如果值为负数，会被当做 sourceLength + beginSlice 看待，这里的sourceLength 是字符串的长度 (例如， 如果beginSlice 是 -3 则看作是: sourceLength - 3);")]),t._v(" "),e("li",[e("code",[t._v("endSlice")]),t._v(" : 可选。在该索引（以 0 为基数）处结束提取字符串。如果省略该参数，slice会一直提取到字符串末尾。如果该参数为负数，则被看作是 sourceLength + endSlice，这里的 sourceLength 就是字符串的长度(例如，如果 endSlice 是 -3，则是, sourceLength - 3)。")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("注意")]),t._v(" "),e("p",[e("code",[t._v("slice()")]),t._v(" 提取的新字符串包括 "),e("code",[t._v("beginSlice")]),t._v(" 但不包括 "),e("code",[t._v("endSlice")]),t._v("。")])]),t._v(" "),e("h2",{attrs:{id:"split"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#split"}},[t._v("#")]),t._v(" split")]),t._v(" "),e("blockquote",[e("p",[t._v("使用指定的分隔符字符串将一个"),e("code",[t._v("String")]),t._v("对象分割成字符串数组，以将字符串分隔为子字符串，以确定每个拆分的位置。")])]),t._v(" "),e("h3",{attrs:{id:"语法-7"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-7"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.split(targetString,[separator[, limit]])\n")])])]),e("h4",{attrs:{id:"参数-7"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-7"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 在该字符串中查找；")]),t._v(" "),e("li",[e("code",[t._v("separator")]),t._v(": 指定表示每个拆分应发生的点的字符串;")]),t._v(" "),e("li",[e("code",[t._v("limit")]),t._v(" : 可选。一个整数，限定返回的分割片段数量。")])]),t._v(" "),e("h4",{attrs:{id:"返回值"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#返回值"}},[t._v("#")]),t._v(" 返回值")]),t._v(" "),e("p",[t._v("返回源字符串以分隔符出现位置分隔而成的一个 Array")]),t._v(" "),e("h2",{attrs:{id:"substring"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#substring"}},[t._v("#")]),t._v(" substring")]),t._v(" "),e("blockquote",[e("p",[e("code",[t._v("substring()")]),t._v(" 返回一个字符串在开始索引到结束索引之间的一个子集, 或从开始索引直到字符串的末尾的一个子集。")])]),t._v(" "),e("h3",{attrs:{id:"语法-8"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-8"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.substring(targetString,indexStart[, indexEnd])\n")])])]),e("h4",{attrs:{id:"参数-8"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-8"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 在该字符串中截取；")]),t._v(" "),e("li",[e("code",[t._v("indexStart")]),t._v(": 需要截取的第一个字符的索引，该字符作为返回的字符串的首字母;")]),t._v(" "),e("li",[e("code",[t._v("indexEnd")]),t._v(" :一个 0 到字符串长度之间的整数，以该数字为索引的字符不包含在截取的字符串内。")])]),t._v(" "),e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("提示")]),t._v(" "),e("ul",[e("li",[t._v("如果 "),e("code",[t._v("indexStart")]),t._v(" 等于 "),e("code",[t._v("indexEnd")]),t._v("，"),e("code",[t._v("substring")]),t._v(" 返回一个空字符串。")]),t._v(" "),e("li",[t._v("如果省略 "),e("code",[t._v("indexEnd")]),t._v("，"),e("code",[t._v("substring")]),t._v(" 提取字符一直到字符串末尾。")]),t._v(" "),e("li",[t._v("如果任一参数小于 "),e("code",[t._v("0")]),t._v(" 或为 "),e("code",[t._v("NaN")]),t._v("，则被当作 "),e("code",[t._v("0")]),t._v("。")]),t._v(" "),e("li",[t._v("如果任一参数大于 "),e("code",[t._v("targetString.length")]),t._v("，则被当作 "),e("code",[t._v("targetString.length")]),t._v("。")]),t._v(" "),e("li",[t._v("如果 "),e("code",[t._v("indexStart")]),t._v(" 大于 "),e("code",[t._v("indexEnd")]),t._v("，则 "),e("code",[t._v("substring")]),t._v(" 的执行效果就像两个参数调换了一样")])])]),t._v(" "),e("h2",{attrs:{id:"tolowercase"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#tolowercase"}},[t._v("#")]),t._v(" toLowerCase")]),t._v(" "),e("blockquote",[e("p",[e("code",[t._v("toLowerCase()")]),t._v(" 将目标字符串值转为小写形式")])]),t._v(" "),e("h3",{attrs:{id:"语法-9"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-9"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.toLowerCase(targetString)\n")])])]),e("h4",{attrs:{id:"参数-9"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-9"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 目标字符串")])]),t._v(" "),e("h2",{attrs:{id:"touppercase"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#touppercase"}},[t._v("#")]),t._v(" toUpperCase")]),t._v(" "),e("blockquote",[e("p",[e("code",[t._v("toUpperCase()")]),t._v(" 将目标字符串值转为大写形式")])]),t._v(" "),e("h3",{attrs:{id:"语法-10"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-10"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.toUpperCase(targetString)\n")])])]),e("h4",{attrs:{id:"参数-10"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-10"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 目标字符串")])]),t._v(" "),e("h2",{attrs:{id:"trim"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#trim"}},[t._v("#")]),t._v(" trim")]),t._v(" "),e("blockquote",[e("p",[e("code",[t._v("trim()")]),t._v(" 从一个字符串的两端删除空白字符。在这个上下文中的空白字符是所有的空白字符 (space, tab, no-break space 等) 以及所有行终止符字符（如 LF，CR）")])]),t._v(" "),e("h3",{attrs:{id:"语法-11"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#语法-11"}},[t._v("#")]),t._v(" 语法")]),t._v(" "),e("div",{staticClass:"language-wxml extra-class"},[e("pre",{pre:!0,attrs:{class:"language-text"}},[e("code",[t._v("string.trim(targetString)\n")])])]),e("h4",{attrs:{id:"参数-11"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#参数-11"}},[t._v("#")]),t._v(" 参数")]),t._v(" "),e("ul",[e("li",[e("code",[t._v("string")]),t._v(": "),e("code",[t._v("wxs")]),t._v(" 引入时 "),e("code",[t._v("module")]),t._v(" 的名字；")]),t._v(" "),e("li",[e("code",[t._v("targetString")]),t._v(": 目标字符串")])]),t._v(" "),e("RightMenu")],1)}),[],!1,null,null,null);a.default=v.exports}}]);