473,385 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how do I code to check if a string does not equal another string? a value?

I understand how to use the equals, and know that there is an option to use '!' for unequal check, but in my case, I am testing against a value in quotes. See my code below.... how do I use the '!' to check against a value in quotes? I also would like to change this test to a while loop, rather than an if/else. I am hoping this will still work in that case (??)

if ("quit".equals(inputWord)) { // checks for string=quit.

JK
Nov 18 '11 #1
1 3515
Leen
22
try this please
if (("quit".equals(inputWord)==false)
Nov 20 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: usgog | last post by:
I need to implement a function to return True/false whether String A contains String B. For example, String A = "This is a test"; String B = "is is". So it will return TRUE if String A includes two...
2
by: Susan Baker | last post by:
Hi, I have declared a class MyClass in a header file MyClass.h I have then gone onto define the class in MyClass.cpp. This is (roughly) what the definition (.cpp) file looks like: #include...
6
by: Webgour | last post by:
How to go from string "abc" to string "a|b|c"?
5
by: Dmitriy Lapshin [C# / .NET MVP] | last post by:
Hi all, I think the VB .NET compiler should at least issue a warning when a function does not return value. C# and C++ compilers treat this situation as an error and I believe this is the right...
10
by: lchian | last post by:
Hi, For two stl strings s1 and s2, I got different results from strcmp(s1.c_str(), s2.c_str()) and s1.compare(s2) can someone explain what these functions do? It seems that strcmp gives...
5
by: Gary Wessle | last post by:
hi or is there a better way to check the existence of "py" in a string "s"? string s = "djrfpyfd"; string t = "py"; string r = s.substr(s.find("py"),2); cout << (t==r) << endl;
3
by: jwgoerlich | last post by:
Hello group, I am working on a query string class. The purpose is to parse name-value pairs from incoming text. Currently, I am using the Regex code below. I have two questions. First, the...
13
by: nishit.gupta | last post by:
Is their any fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" Thnx
18
by: Umesh | last post by:
Do you have any answer to it? thx.
12
by: Slaunger | last post by:
Hi, I am new here and relatively new to Python, so be gentle: Is there a recommended generic implementation of __repr__ for objects equal by value to assure that eval(repr(x)) == x independet...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.