• Seaching Strings

    From Cyclops@VERT/SRBBS to All on Tue Apr 4 14:51:00 2006
    How does one do a simple string search in js?ããI want to get a simple true/false answer with if string1 is inside string2 atãany position in the string.ãã---ã þ Synchronet þ Shadow River - shadowriver.homeip.netã
  • From Deuce@VERT/SYNCNIX to Cyclops on Tue Apr 4 17:03:00 2006
    Re: Seaching Stringsã By: Cyclops to All on Tue Apr 04 2006 02:51 pmãã > How does one do a simple string search in js?ã >ã > I want to get a simple true/false answer with if string1 is inside string2ã > at any position in the stringããIf string1 is a literal, you can do this:ã(string2.search(/string1/)==-1)ããOtherwise...ã(string2.search(new RegExp(string1))==-1)ãããã---ãThis sig is not directed at Jazzman.ãã---ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
  • From Cyclops@VERT/SRBBS to Deuce on Tue Apr 4 20:48:00 2006
    If string1 is a literal, you can do this:ã > (string2.search(/string1/)==-1)ã > ã > Otherwise...ã > (string2.search(new RegExp(string1))==-1)ããOk, so it is a literal, and if string2 is part of an object, the same appliesãright?ããI should be able to do...ããif(ojb.string2.search(/string1/)==-1ããThat would be if string1 is NOT found right?ããWhat are the //'s for? Are they saying that string1 is literal?ãã---ã þ Synchronet þ Shadow River - shadowriver.homeip.netã
  • From Deuce@VERT/SYNCNIX to Cyclops on Wed Apr 5 20:55:00 2006
    Re: Re: Seaching Stringsã By: Cyclops to Deuce on Tue Apr 04 2006 08:48 pmãã > Ok, so it is a literal, and if string2 is part of an object, the sameã > applies right?ã >ã > I should be able to do...ã >ã > if(ojb.string2.search(/string1/)==-1ããAs long as it can be coerced into a string, yes.ãã > That would be if string1 is NOT found right?ã >ã > What are the //'s for? Are they saying that string1 is literal?ããIt's a shorthand method of expressing a regexp.ããã---ãThis sig is not directed at Jazzman.ãã---ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã