vbscript/asp函数:extract_by_str,指定起止字符串在字符串中截取子串
直接上代码:
<% function extract_by_str(from,s_start,s_end) dim pos_start,pos_end,rtn rtn="" pos_start=instr(from,s_start) if pos_start>0 then pos_start=pos_start+len(s_start) pos_end=instr(pos_start,from,s_end) if pos_end > pos_start then rtn=mid(from,pos_start,pos_end-pos_start) end if end if extract_by_str=rtn end function str="[abcdefghijklmn天地玄黄宇宙洪荒]abcxyzopqlmn" response.write str response.write "c-i:"&extract_by_str(str,"c","i") response.write "天-洪:"&extract_by_str(str,"天","洪") response.write "天-洪:"&extract_by_str(str,"洪","天") response.write "天-e:"&extract_by_str(str,"天","e") response.write "天-n:"&extract_by_str(str,"天","n") %>
延伸阅读
- asp/vbscript函数RemoveHTML(),正则表达式高效删除所有html标签,包括javascript及CSS标签
- asp vbscript报错“字符串空间不够”
- windows 2003 iis6 修改上传文件大小
- php与asp/vbscript对input表单数组的处理比较
- asp/vbscript版Base64函数/Base64编码Base64encode解码Base64decode
- 常见错误 不能打开注册表关键字 'Temporary (volatile) Jet DSN 解决方法/asp+access
- 使用host文件完美解决ASP错误msxml3.dll 错误 '800c0005'
- windows下配置apache支持运行asp
- “常见错误 不能打开注册表关键字” 与 “Provider 错误 ’80004005′ 未指定的错误”解决手记
- javascript实现Base64编码与解码函数
- PHP时间戳函数总结一览
- php进制转换函数
- 如何在windows批处理中添加自定义函数
- MySQL函数 GROUP_CONCAT,相当有用
- MySQL 数字类型转换函数(concat/cast)
0 条评论。