Skip to content

Commit

Permalink
57
Browse files Browse the repository at this point in the history
  • Loading branch information
codershiyar committed May 8, 2020
1 parent fcbe0e4 commit dc5e8ed
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Lesson 9 + 30/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

public class App{

App(){

}
public static void main(String[] args) {


// replaceAll() من خلالها يمكنك استبداله جزء من النص بجزء جديد
// replaceFirst() يقوم بإستبداول قيمة يطابق مع الجزء المحدد من النص , بالجزء جديد
// isEmpty() يستخدم لتحقق إذا كان متغير من نوع بيانات نصي خالي من بيانات او لا
// lastIndexOf() تمركز اخر جزء يطابق مع الجزء المحدد
// startsWith() يستخدم لتحقق إن كان النص يبدأ بجزء الذي تحدده او لا
// endsWith() يستخدم لتحقق إن كان النص ينتهي بجزء الذي تحدده او لا
String text = "Java, I like Java.";
text = text.replaceFirst("not", "@");
boolean isEmpty = text.isEmpty();
int lastIndexOf = text.indexOf("Java");

boolean startsWith = text.startsWith(" ");
boolean endsWith = text.endsWith(".");
// if(text.isEmpty()){

// }else{

// }
System.out.println(endsWith);

}

}






27 changes: 27 additions & 0 deletions Lesson 9 + 30/string_method.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@



// بالدرس 9 تم شرح عناصر التالية
// toLowerCase() Converts a string to lower case letters - تحويل النص إلى احرف الصغيرة
// toUpperCase() Converts a string to upper case letters - يحول النص إلى أحرف كبيرة
// concat() Appends a string to the end of another string - إلحاق النص بنهايةأخرى
// length() Returns the length of a specified string - إرجاع طول النص المحدد
// إرجاع تمركز نص الذي يطابق مع الجزء المحددة
// indexOf() Returns the position of the first found occurrence of specified characters in a string

// بالدرس 30 تم شرح عناصر التالية
// charAt() Returns the character at the specified index (position) - إرجاع الحرف عند الفهرس المحدد )
// substring Extracts the characters from a string - يستخدم لقطع النص وإعادة لك الجزء المحدد الذي قطعته
// trim() Removes whitespace from both ends of a string يحذف الفراغات من بداية ونهاية النص

// equals() // يقارن 2 نصوص . ويقوم بإعادة
// true
// إذا تطابق 2 نصوص , ويقوم بإعادة
// false
// إذا لم تطابق 2 نصوص
Compares two strings. Returns true if the strings are equal, and false if not

//يبحث في نص لقيمة محددة ، ويعيد نص جديدة حيث يتم استبدال القيم المحددة
// replace() // Searches a string for a specified value, and returns a
// new string where the specified values are replaced

38 changes: 38 additions & 0 deletions lesson47/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

public class App{

App(){

}
public static void main(String[] args) {


// replaceAll() من خلالها يمكنك استبداله جزء من النص بجزء جديد
// replaceFirst() يقوم بإستبداول قيمة يطابق مع الجزء المحدد من النص , بالجزء جديد
// isEmpty() يستخدم لتحقق إذا كان متغير من نوع بيانات نصي خالي من بيانات او لا
// lastIndexOf() تمركز اخر جزء يطابق مع الجزء المحدد
// startsWith() يستخدم لتحقق إن كان النص يبدأ بجزء الذي تحدده او لا
// endsWith() يستخدم لتحقق إن كان النص ينتهي بجزء الذي تحدده او لا
String text = "Java, I like Java.";
text = text.replaceFirst("not", "@");
boolean isEmpty = text.isEmpty();
int lastIndexOf = text.indexOf("Java");

boolean startsWith = text.startsWith(" ");
boolean endsWith = text.endsWith(".");
// if(text.isEmpty()){

// }else{

// }
System.out.println(endsWith);

}

}






27 changes: 27 additions & 0 deletions lesson47/string_method.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@



// بالدرس 9 تم شرح عناصر التالية
// toLowerCase() Converts a string to lower case letters - تحويل النص إلى احرف الصغيرة
// toUpperCase() Converts a string to upper case letters - يحول النص إلى أحرف كبيرة
// concat() Appends a string to the end of another string - إلحاق النص بنهايةأخرى
// length() Returns the length of a specified string - إرجاع طول النص المحدد
// إرجاع تمركز نص الذي يطابق مع الجزء المحددة
// indexOf() Returns the position of the first found occurrence of specified characters in a string

// بالدرس 30 تم شرح عناصر التالية
// charAt() Returns the character at the specified index (position) - إرجاع الحرف عند الفهرس المحدد )
// substring Extracts the characters from a string - يستخدم لقطع النص وإعادة لك الجزء المحدد الذي قطعته
// trim() Removes whitespace from both ends of a string يحذف الفراغات من بداية ونهاية النص

// equals() // يقارن 2 نصوص . ويقوم بإعادة
// true
// إذا تطابق 2 نصوص , ويقوم بإعادة
// false
// إذا لم تطابق 2 نصوص
Compares two strings. Returns true if the strings are equal, and false if not

//يبحث في نص لقيمة محددة ، ويعيد نص جديدة حيث يتم استبدال القيم المحددة
// replace() // Searches a string for a specified value, and returns a
// new string where the specified values are replaced

0 comments on commit dc5e8ed

Please sign in to comment.