Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

How to compare String with " ?

Thread view: 
lemnfoon@gmail.com - 02 Dec 2007 01:22 GMT
Hi i need to compare a string that has " at the front and the back.
how do i compare it ?

Thanks
Arne Vajhøj - 02 Dec 2007 02:20 GMT
> Hi i need to compare a string that has " at the front and the back.
> how do i compare it ?

.equals works fin on String's even with double quotes in them.

Are you asking how to get double quotes in a literal String ?

if(s.equals("\"foobar\"")) {

Arne
lemnfoon@gmail.com - 02 Dec 2007 03:00 GMT
> lemnf...@gmail.com wrote:
> > Hi i need to compare a string that has " at the front and the back.
[quoted text clipped - 7 lines]
>
> Arne

OK. thanks
Another question,
how do i split a string using "/"?

for example www.yahoo.com/abc
i wan to split into www.yahoo.com and abc.

tried this but cannot work ?
String[] subStringAdd = str.split("\\/");
lemnfoon@gmail.com - 02 Dec 2007 03:02 GMT
On Dec 2, 11:00 am, lemnf...@gmail.com wrote:

> > lemnf...@gmail.com wrote:
> > > Hi i need to compare a string that has " at the front and the back.
[quoted text clipped - 17 lines]
> tried this but cannot work ?
> String[] subStringAdd = str.split("\\/");

solve this.. my code error..
Roedy Green - 02 Dec 2007 04:04 GMT
>Hi i need to compare a string that has " at the front and the back.
>how do i compare it ?

read up on escape sequences.
see http://mindprod.com/jgloss/literal.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.