---
title: "asp 字符串包含函数"
author: "haimav"
date: "2009-09-28T18:11:45Z"
tags: []
slug: "asp"
draft: false
lastmod: "2009-09-28T18:11:45Z"
id: 479756
url: "https://haimav.iteye.com/blog/479756"
---

asp 字符串包含函数

&lt;%  
ab="abcdefg"  
你可以用Instr()或者InstrRev()来判断

if Instr(ab, "a")&gt;0 then或  
if InstrRev(ab, "a")&gt;0　then

qq:9231333

[http://www.yy66.net](http://www.yy66.net/)

有  
else  
无

%&gt;

# instr

　　VB和VBS函数  
　　【名称】  
　　InStr  
　　【类别】  
　　字符串函数  
　　【方法】  
　　InStr(\[start, ]string1, string2\[, compare])  
　　【参数】  
　　InStr 函数的语法具有下面的参数：  
　　部分  
　　说明  
　　start  
　　可选参数。为数值表达式，设置每次搜索的起点。如果省略，将从第一个字符的位置开始。如果 start 包含 Null，将发生错误。如果指定了 compare 参数，则一定要有 start 参数。  
　　string1  
　　必要参数。接受搜索的字符串表达式。  
　　string2  
　　必要参数。被搜索的字符串表达式。  
　　Compare  
　　可选参数。指定字符串比较。如果 compare 是 Null，将发生错误。如果省略 compare，Option Compare 的设置将决定比较的类型。

# InstrRev

　　描述  
　　返回某字符串在另一个字符串中最后出现的位置。  
　　语法  
　　InstrRev(string1, string2\[, start\[, compare]])  
　　InstrRev 函数的语法有以下参数：  
　　参数 描述  
　　string1 必选。接受搜索的字符串表达式。  
　　string2 必选。被搜索的字符串表达式。  
　　start 可选。数值表达式，用于设置每次搜索的开始位置。如果省略，则默认值为 -1，表示从最后一个字符的位置开始搜索。如果 start 包含 Null，则出现错误