<Button type="primary" @click="doIncludes()" style="margin-right: 8px;">验证是否包含</Button>
<Button type="primary" @click="doStartsWith()" style="margin-right: 8px;">验证是否某某开头</Button>
<Button type="primary" @click="doEndsWith()" style="margin-right: 8px;">验证是否某某结尾</Button>
<Button type="primary" @click="doPadStart()" style="margin-right: 8px;">字符串长度补全-前面补足</Button>
<Button type="primary" @click="doPadEnd()" style="margin-right: 8px;">字符串长度补全-结尾补足</Button>
<Button type="primary" @click="doTrimStart()" style="margin-right: 8px;">消除字符串开头空格</Button>
<Button type="primary" @click="doTrimEnd()" style="margin-right: 8px;">消除字符串结尾空格</Button>
doIncludes () {
if (this.includeStr) {
alert(this.sourceStr.includes(this.includeStr))
} else {
alert(false)
}
},
doStartsWith () {
if (this.includeStr) {
alert(this.sourceStr.startsWith(this.includeStr))
} else {
alert(false)
}
},
doEndsWith () {
if (this.includeStr) {
alert(this.sourceStr.endsWith(this.includeStr))
} else {
alert(false)
}
},
doPadStart () {
alert((this.padStr + '').padStart(2, 0))
},
doPadEnd () {
alert((this.padStr + '').padEnd(2, 0))
}