开发者

how to find a particular value from a string in ASP

开发者 https://www.devze.com 2023-02-09 14:26 出处:网络
how do you find a particular value from a string in ASP? dim temp=\"alpha,bravo,charlie\" how 开发者_运维百科do i find if \'alpha\' exists in temp?

how do you find a particular value from a string in ASP?

dim temp="alpha,bravo,charlie"

how 开发者_运维百科do i find if 'alpha' exists in temp?

Thank You


You can use the function instr to check for the string.

For more instructions follow this link:

http://www.w3schools.com/Vbscript/func_instr.asp


Instr is good for quick solutions, if your strins is BIG or you have to use thisoften you are better off met converting the string to an array an dthen use filter to find teh value

so

dim temp, aTemp
temp="alpha,bravo,charlie" 
aTemp = split(temp,",")
aFound = Filter(aTemp , "alpha") ' aFound (0) contains "alpha" or is an empty array if not found.

Grtz

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号