InStr problems

Results 1 to 2 of 2

Thread: InStr problems

  1. #1
    Join Date
    Dec 1969

    Default InStr problems

    I&#039m trying to determine if a string contains another string by using the InStr method with this code<BR><BR>test=InStr(1,firststring,searchsting,1 ) and later am testing the valuable of test to determine if the string is contained and am having problems. here is the code<BR><BR>if test = 1 (the searchstring is in the firststring) then<BR>do code.<BR><BR>However, I am getting problems with this method.<BR><BR>Does anyone have a more effective way of checking for strings?<BR>

  2. #2
    Join Date
    Dec 1969

    Default I thinks...

    I may be wrong but I think you&#039re simply overcoding.<BR><BR>test=InStr(lookatstring, lookinforstring)<BR>if test&#062;0 then<BR> do code<BR>else<BR> don&#039t<BR><BR>where lookatstring is what you&#039re searching and<BR>lookinforstring is what you&#039re looking to see if is in there.<BR><BR>If it isn&#039t test should = -1<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts