ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل AMITESH KUMAR , SOFTWARE DEVELOPER , TECHZONE TECHNOLOGY PVT. LTD.
تاريخ النشر: 2013/11/02
Ashok Yadav
من قبل Ashok Yadav , trainee , S.O Infotech Pvt. Ltd.

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

Amitesh Rai
من قبل 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
من قبل 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.

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟