عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 08-11-2012, 04:03 AM   #4

Hams Al-Harbi

قلبيْ بـ الوفْآ رآقيْ..:$

الصورة الرمزية Hams Al-Harbi

 
تاريخ التسجيل: Jul 2010
التخصص: مآ تع ـرفوآ إن اللقآآفةة قرآآفة ..؟ :d:p
نوع الدراسة: إنتظام
المستوى: الخامس
الجنس: أنثى
المشاركات: 564
افتراضي رد: شرح كافة ميثود الـ String الموجودة في السلايدز + بالإضافة لأمثلة

"

و ع ـليكمـ السلامـ ورح ـمة الله وبركاتهـ..

يع ـطيكـٍ الع ـآفيةة أسووومـ..و سلآمتكـٍ ع ـيوونكـٍ ..مآتشووفي ششر يآآرب..:$


"

شآهي أخ ـضر..هذآ الكلآمـ نسخ ـتهـ لكـٍ..

package Exam;

public class Explain {

public static void main(String[] args) {

String name1= "shoroog";


char d=name1.charAt(3); // it will return character so we will declare a variable from type char


System.out.println(d); // it will print the letter at index 3



int f=name1.compareTo("sesraa");


System.out.println(f); // A string is less than another if it comes before the other in dictionary order.
// A string is greater than another if it comes after the other in dictionary order.
// here it will return a positive number because in the dictionary order the "se" comes before "sh"



int w=name1.compareTo("tsraa");
System.out.println(w); // it will return negative number because the letter "t" comes before "s"


int k = name1.compareTo(name1);
System.out.println(k); // it will return zero because we compare name by it self and the are equal


System.out.println(name1.concat(" esraa")); // it will join the two names , it is like the + operator



boolean e=name1.equals("Shoroog");


System.out.println(e);// it will return false because the name1 start with small letter but "Shoroog" Start with Capital letter



boolean y=name1.equalsIgnoreCase("Shoroog");


System.out.println(y);// it will return true because the case is ignored so it will be equal



int l=name1.length(); // it will return the length , and if you want to compute length you shoud start from one because it is not indices
System.out.println(l);

System.out.println("esraa".length());// you can use method string by other way like this ^^ , you declare a string variable by double qutation


System.out.println(name1.indexOf('o'));//it will return the index of the first occurance of letter o
System.out.println(name1.lastIndexOf("o"));//ا it will return the index of the last occurance of letter o


System.out.println(name1.toUpperCase()); // it will be converted to Uppercase


System.out.println("ESRAA".toLowerCase()); // it will be converted to lowercase




System.out.println(name1.substring(3));// it will print the string variable starting from index 3 to the end


System.out.println(name1.substring(3,6));//it will print the سtring variable starting from the start index until reach
// the index 5 , so here the end index will not printed



System.out.println(name1.replace('o', 'w')); // this method will change all the letter o in "shoroog" to be "shwrwwg"

System.out.println(" esraa hamad".trim()); // it will delete " المسافة البادئة " يعني الفراغات اللي تكون زيادة في بداية الجملة






}

}




"


بـ التووفيق..



"

 

توقيع Hams Al-Harbi  

 

"

لستُ سيئة ج ـدآ.. و لن أكون ذلك الملآك .. فـ من سـ يقذفني بـ السوء فـ ليتمهّل .. و من سـ يُنزهني ع ـن كل شيء فـ ليح ـترص..
سيد الاستغ ـفآر
اللهم أنت ربي لا إله إلا أنت خ ـلقتني و أنآ عبدك و أنآ على عهدك و وع ـدك مااستطعت ,
أعوذ بك من شر مآ صنعت و أبوء لك بنعمتك علي وأبوء بذنبي..
فاغفر لي فإنه لا يغفر الذنوب إلا أنت..

~..||..~



نقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلةنقرتين لعرض الصورة في صفحة مستقلة
"

 

Hams Al-Harbi غير متواجد حالياً   رد مع اقتباس