Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to compare two string without using any per-defined method ?

user-image
Question added by AMITESH KUMAR , SOFTWARE DEVELOPER , TECHZONE TECHNOLOGY PVT. LTD.
Date Posted: 2013/11/02
Ashok Yadav
by Ashok Yadav , trainee , S.O Infotech Pvt. Ltd.

you can first convert that in char array and then compare each character

Amitesh Rai
by Amitesh Rai , SOFTWARE DEVELOPER , techzone technology pvt ltd

already i  have  gone through that  src.zip  and rt.jar ,its ok  but  im  not sutisfied.

Daanish Rumani
by Daanish Rumani , Product Manager , Publicis Sapient

Each String in Java is a CharacterSequence. So you can compare and manipulate two strings the way you want it.

 

However I would recommend you to not do so on your own. The inbuilt methods take care of all the things that you would have never imagined are required to be taken care of (e.g. languages and locales).

 

However if you still want to do it on your own and are asking for code samples then the best place to get "inspired" from is JDK itself! You can check the code of the string methods provided in src.zip shipped as part of the JDK distribution to see how it does its magic.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.