Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy ASP ignore words question

Status
Not open for further replies.

techskool

Technical User
Jun 20, 2002
151
GB
This is gonna seem really daft, im not quite with it today

Say i was asking ASP to ignore a word when it was performing an action:

----
varIgnore = "materials.asp"
If objFileItem.Name <> varIgnore Then
....
----

How would i make it ignore

1)more files than just the one ive specified
2)files that end with an extension, which i dont know the name of

Thanks guys

Dave

:)


 
put the list of things you want to ignore in an array, then loop through the array on the text you want to check for ignores, and replace each occurence of the array element with a null string.

That's just shooting from the hip here. Good luck!

Take Care,
Mike
 
or set a pattern containing the words and hit it with a regular expression match test.

_____________________________________________________________________
onpnt2.gif

Hakuna matata!!
 
Thanks guys.

Have you go an example of how this array would work, or am array i can look at

Cheers

Dave

:)
 
Here's the array method (I'd have to look into the regex method):

Code:
Dim arrData
Dim strText
Dim inCount

strText = &quot;bla blabla bla word1 lkasdj fklj word2 askdjfl jasdfjk lkkljas df word3 asdklfj lasdf  skdjkks word4&quot;
arrData = Array(&quot;word1&quot;, &quot;word2&quot;, &quot;word3&quot;, &quot;word4&quot;)
For intCount = 0 To UBound(arrData)
    strText = Replace(strText, arrData(intCount) ,&quot;&quot;)
Next
Response.Write(&quot;This is the replaced text:<br>&quot; & strText)

Good Luck!

Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top