473,386 Members | 1,736 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,386 software developers and data experts.

Testing if a string is NOT equal to...

Hi, I'm currently coding a Java program for a University coursework, and I'm a little bit stuck.

How do I find out if a string is NOT equal to a certain value? I know to test if it is equal, you use .equals, but I have no idea how to test if it's not equal to.

Thanks
Aug 6 '08 #1
2 121630
Laharl
849 Expert 512MB
Use ! to negate a boolean expression, in this case !str1.equals(str2).
Aug 6 '08 #2
Wow, thanks for the speedy reply,t hat works perfect :) Thanks again
Aug 6 '08 #3

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

Similar topics

7
by: Bart Nessux | last post by:
I have some php scripts that I use on several machines. Each machine has an identical copy of a mysql database that the scripts run against. The only differences in the DBs are the user names and...
5
by: Pavils Jurjans | last post by:
Hello, Here's an excerpt from msdn online documentation: An index is the position of a Char, not a Unicode character, in a String. An index is a zero-based, nonnegative number starting from...
11
by: Dan Bass | last post by:
which one do you use and why? MyString == null || MyString == "" vs MyString == null || MyString.Length == 0
3
by: Locia | last post by:
I have a Template base class and another subclasses of Template. I have a tree structure of template object. class Template { ArrayList child; public virtual String Eval(Environment env) {
2
by: TimothyBarbour | last post by:
I am a newbie to VB.NET (and VB in general). I'd like to replace quote marks with the string. For example, I have a string that is "3dmesh 45 45" including the quotes. I'd like to remove the...
4
by: squash | last post by:
I have a string equal to 'www/' that I want to use in a preg_match. Php keeps giving me the warning: Warning: preg_match(): Unknown modifier '/' How can I escape the string so the / in www/ is...
3
by: bussiere maillist | last post by:
i've got a very long string and i wanted to convert it in binary like string = """Monty Python, or The Pythons, is the collective name of the creators of Monty Python's Flying Circus, a British...
4
sumittyagi
by: sumittyagi | last post by:
Hi All! I am confused in the functioning of String.intern() function. public class StringTest { public static void main(String args) { String test2 = new String("ABC");...
20
by: Xcriber51 | last post by:
Hi -- I'm not entirely familiar with the norms and standard libraries of JavaScript so if the answer to this is yesterday's news, please ignore. I'm trying to write a simple text formatting...
4
by: =?Utf-8?B?ZmFpcnl2b2ljZQ==?= | last post by:
Hi, I want to ask some basic question about the string type. When compiling the unsafe code: --------- string a = "wori"; string* b = &a; --------- it pops up errors saying both 'string*b' and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.