小白教程
所有教程
关于
Search
172.70.178.233
172.70.178.233
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func mid”的源代码
本页内容
上一节:
Func_trim
下一节:
Func_replace
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:Mid}}[[Category:vbscript ref functions|87]] = VBScript Mid 函数 = [[vbscript ref functions|完整的 VBScript 参考手册]] Mid 函数从字符串中返回指定数量的字符。 '''提示:'''请使用 Len 函数来确定字符串中的字符数量。 === 语法 === <pre> Mid(string,start[,length]) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | string | 必需。从其中返回字符的字符串表达式。 |- | start | 必需。规定起始位置。如果设置为大于字符串中的字符数量,则返回空字符串("")。 |- | length | 可选。要返回的字符数量。 |} == 实例 1 == 返回 1 个字符,从位置 1 开始: <sample title="" desc="" lang="vb" hererun="1"> <script type="text/vbscript"> txt="This is a beautiful day!" document.write(Mid(txt,1,1)) </script> </sample> 以上实例输出结果: <sample title="" desc="" lang="vb" hererun="1"> T </sample> == 实例 2 == 返回 15 个字符,从位置 1 开始: <sample title="" desc="" lang="vb" hererun="1"> <script type="text/vbscript"> txt="This is a beautiful day!" document.write(Mid(txt,1,15)) </script> </sample> 以上实例输出结果: <sample title="" desc="" lang="vb" hererun="1"> This is a beaut </sample> == 实例 3 == 返回所有字符,从位置 1 开始: <sample title="" desc="" lang="vb" hererun="1"> <script type="text/vbscript"> txt="This is a beautiful day!" document.write(Mid(txt,1)) </script> </sample> 以上实例输出结果: <sample title="" desc="" lang="vb" hererun="1"> This is a beautiful day! </sample> == 实例 4 == 返回所有字符,从位置 12 开始: <sample title="" desc="" lang="vb" hererun="1"> <script type="text/vbscript"> txt="This is a beautiful day!" document.write(Mid(txt,12)) </script> </sample> 以上实例输出结果: <sample title="" desc="" lang="vb" hererun="1"> eautiful day! </sample> [[vbscript ref functions|完整的 VBScript 参考手册]]
返回至“
Func mid
”。
上一节:
Func_trim
下一节:
Func_replace