Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Location
    Silicon Valley
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do i test missing string w/a piece of code

    How do I test if a word is missing from a string. For example, the following contains a missing word:

    var test = "this is a "

    Please send me some ideas.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could use the charAt() function.

  • #3
    New to the CF scene
    Join Date
    Jun 2002
    Location
    Silicon Valley
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How can I do this non-programmatically.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Huh? What do you mean by non-programmatically? What is your criteria for determining there is a missing word? If you can answer these questions maybe we can help out more.

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well the basic way is

    mainString.indexOf("your String")

    that is:

    var foo1="hallo world how are you?"

    var foo2="are you?"

    foo1.indexOf(foo2)

    produces -1 (LESS 1 if the string foo2 is not present INSIDE foo1) or a positive number if it is present.

    I don't know what you mean by non programmatically. Arguably, you're wondering if there is a way to do it by html, but no: only a scripting language can let you do these things: html is static (in the sense it is not a scripting or programming language!)

    ciao

    PS John, I apologize if I meddle with this but I was struck by the quotation in your signature for it is clearly Descartes and a beautiful sentence actually, but maybe I don't know enouhg english so maybe "codito" has some meaning in english and was meant as an intentional change, but if wasn't so and obviously if I'm not kistaken the original latin sentence is "cogito ergo sum", g instead of d: a fascinating sentence by Descartes, anyway! Good choice!
    Last edited by TrueLies; 06-19-2002 at 11:32 PM.
    Alberto http://www.unitedscripters.com/

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    No worries I love it when other members jump right in!

    Codito is meant to be a play on words. While Descartes is famous for "Cognito Ergo Sum", I think therefore I am. I take it to a differnt plain with "Codito Ergo Sum" a bit of Psuedo Latin for I code therfore I am. I actually saw this phrase on the t-shirt of one of my developers and instantly fell in love with it.

  • #7
    New to the CF scene
    Join Date
    Jun 2002
    Location
    Silicon Valley
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, TrueLies. Yes, I meant HTML way by saying non-programmatically. I think you're just being humble when you say you don't know much English.

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by JohnKrutsch
    I take it to a differnt plain with "Codito Ergo Sum" a bit of Psuedo Latin for I code therfore I am.
    /me just a whispers® to john....
    :O))) just a ta® for the explanation.../me just a lways® wondered what thattt meant...hehehe...
    /me does notepad™ nottt latin...rotflmao!!! 'cept sometimes??? /mes code look like just a greek®...hehehe...
    The New JustaBuster Version 2.0 OR JustaBusta Lite V2.0
    ...just a special® thanx kinda hugs to jkd n' nex ...:O)))

    CommemorateWTC.com --Please lend your support


  •  

    Posting Permissions

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