View Full Version : How do i test missing string w/a piece of code
06-19-2002, 08:40 PM
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.:)
06-19-2002, 08:45 PM
You could use the charAt() function.
06-19-2002, 08:54 PM
How can I do this non-programmatically.
06-19-2002, 09:47 PM
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.
06-19-2002, 10:27 PM
well the basic way is
var foo1="hallo world how are you?"
var foo2="are you?"
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!)
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!
06-19-2002, 10:56 PM
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.
06-19-2002, 11:03 PM
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.
06-20-2002, 03:22 AM
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...
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.