#1
  1. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,118
    Rep Power
    538

    Check if question mark exists in string.


    Hi,

    Looking to return true if a question mark (?) exists in a given string.

    I was thinking of something like the following, but it obviously doesn't work.
    alert('/?'.test('my?string'));

    Can anyone help?

    Thank you
  2. #2
  3. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    706
    Rep Power
    203
    try indexOf

    mystring.indexOf("?")

    Comments on this post

    • NotionCommotion agrees : Works Great!

IMN logo majestic logo threadwatch logo seochat tools logo