ASP中一个字符串处理类(加强)(VBScript)(2) '' @功能说明: 检查源字符串str是否以chars开头 '' @参数说明: - str [string]: 源字符串 '' @参数说明: - chars [string]: 比较的字符/字符串 '' @返回值: - [bool] '**************************************************************************** public function startsWith(byVal str, chars) if Left(str,len(chars)) = chars then startsWith = true else startsWith = false end if end function
'**************************************************************************** '' @功能说明: 检查源字符串str是否以chars结尾 '' @参数说明: - str [string]: 源字符串 '' @参数说明: - chars [string]: 比较的字符/字符串 '' @返回值: - [bool] '**************************************************************************** public function endsWith(byVal str, chars) if Right(str,len(chars)) = chars then endsWith = true else endsWith = false end if end function
'**************************************************************************** '' @功能说明: 复制N个字符串str '' @参数说明: - str [string]: 源字符串 '' @参数说明: - n [int]: 复制次数 '' @返回值: - [string] 复制后的字符串 '**************************************************************************** public function clone(byVal str, n) for i = 1 to n value = value & str next clone = value end function