这个主要应用于,获取用户输入的时候,防止用户不小心,多输入了一个空格,导致验证无法通过,多用于用户名跟密码的,好多情况下,大家复制的winrar的解压密码,都会默认多输入一个空格,所以这个是需要注意的。在获取字符串时,用trim清理下前后的空格,对程序开发人员是个好习惯。使用方法: password=trim(request("password")) 复制代码 代码如下: dim txttxt=" This is a beautiful day! " document.write(Trim(txt)) 输出:"This is a beautiful day!" ASP LTrim 函数 LTrim 函数可返回不带前导空格 (LTrim)的字符串复制代码 代码如下: dim txttxt=" This is a beautiful day! " document.write(LTrim(txt)) 输出:"This is a beautiful day! "asp rtrim RTrim 属性可返回不带后续空格 (RTrim)的字符串 复制代码 代码如下: dim txttxt=" This is a beautiful day! " document.write(RTrim(txt)) 输出:" This is a beautiful day!"
推荐阅读
Active Server Pages 错误 ''ASP 0201'' 修复方法
问题:
1. 访问 ASP 页面时,出现以下错误:
Active Server Pages 错误 'ASP 0201' 错误无效的默认脚本语言 该应用程序地应的默认脚本语言无效2. 查看 HKEY_LOCAL_MACHINESOFTWAREClasses,发现这个 Cla>>>详细阅读
本文标题:ASP trim,ltrim,rtrim 去前后空格 函数
地址:http://www.17bianji.com/kaifa2/ASP/31903.html
1/2 1