checking to see if a character exist in a string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Realtime

    #1

    checking to see if a character exist in a string



    Lets say i got a string like this

    $StrInfo="1,2,3 ";

    I want to be able to check if the string exists without using strpos or
    arrays. If it exists it will return true or sucess :)

    Thanks a million :)


  • Scott

    #2
    Re: checking to see if a character exist in a string

    On Tue, 2006-04-04 at 01:52 +0000, Realtime wrote:[color=blue]
    >
    > Lets say i got a string like this
    >
    > $StrInfo="1,2,3 ";
    >
    > I want to be able to check if the string exists without using strpos or
    > arrays. If it exists it will return true or sucess :)
    >
    > Thanks a million :)
    >
    >[/color]

    You could use regular expressions... but why?

    Comment

    • Geoff Berrow

      #3
      Re: checking to see if a character exist in a string

      Message-ID: <de9f55a6a8338c 825800219cf80@n ews.cogeco.ca> from Realtime
      contained the following:
      [color=blue]
      >
      >
      >Lets say i got a string like this
      >
      >$StrInfo="1,2, 3";
      >
      >I want to be able to check if the string exists without using strpos or
      >arrays. If it exists it will return true or sucess :)
      >[/color]
      if(isset($StrIn fo) &&$StrInfo=="1, 2,3"){

      //do stuff

      }
      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • Iván Sánchez Ortega

        #4
        Re: checking to see if a character exist in a string

        -----BEGIN PGP SIGNED MESSAGE-----
        Hash: SHA1

        Realtime wrote:
        [color=blue]
        > Lets say i got a string like this
        >
        > $StrInfo="1,2,3 ";
        >
        > I want to be able to check if the string exists[/color]

        Check if a string exists? Then RTFM:

        Determine if a variable is declared and is different than null


        - --
        - ----------------------------------
        Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net


        Proudly running Debian Linux with 2.6.15-1-686 kernel, KDE3.5.0, and PHP
        5.1.2-1+b1 generating this signature.
        Uptime: 09:19:38 up 11:56, 2 users, load average: 0.16, 0.33, 0.29

        -----BEGIN PGP SIGNATURE-----
        Version: GnuPG v1.4.2.2 (GNU/Linux)

        iD8DBQFEMh453jc Q2mg3Pc8RAonJAJ wIaN0t/AZHPOMNtm5LeUo1 X/4ecACfc1R8
        wQ7h0PbzFI35vSr rIlygUqk=
        =ZM5T
        -----END PGP SIGNATURE-----

        Comment

        Working...