Skip to content

Commit

Permalink
new java files added
Browse files Browse the repository at this point in the history
  • Loading branch information
codershiyar committed Dec 23, 2022
1 parent 045efa1 commit f160878
Show file tree
Hide file tree
Showing 18 changed files with 547 additions and 215 deletions.
47 changes: 29 additions & 18 deletions Lesson 42 - الدرس/App.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@

public class App extends Payment {


public class App {
public static void main(String[] args) {
String text = "Are you happy? \nYes\nNo ";
System.out.print(text);


// الرمز '\ لإضافة الرمز ' في مكان وضعها

// الرمز "\ لإضافة الرمز " في مكان وضعها.

// يضيف عدة مسافات في مكان وضعها \t : الرمز

//يجعل المحتوى الذي يأتي بعدها ينزل على سطر جديد. \n : الرمز


String text1 = "I like to learn programming \twith \\Coder Shiyar\\";
System.out.println(text1);
// String text2 = """
// I like to learn programming
// with Coder Shiyar""";
// System.out.println(text2);
}
}

/* -------------------------------------------------------------------------------------------------------
Java String - النصوص في الجافا
-------------------------------------------------------------------------------------------------------
1: "string in 1 line" نصوص في سطر واحد
2: """
multiple line strings - نصوص متعدد اسطر
"""
-------------------------------------------------------------------------------------------------------
Java Escape Characters - أحرف خاصة في جافا
-------------------------------------------------------------------------------------------------------
Special characters Display Result
\' Single quotation mark '
\" Double quotation mark "
\\ Backslash \
\n Newline بدء سطر جديد
\t Tab تقديم نص قليل للامام مثلما يفعله زر تاب في كيبورد
----------------------------------------💕Coder Shiyar💕----------------------------------------------
}
*/


21 changes: 21 additions & 0 deletions Lesson 42 old - الدرس/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

public class App extends Payment {


public static void main(String[] args) {
String text = "Are you happy? \nYes\nNo ";
System.out.print(text);


// الرمز '\ لإضافة الرمز ' في مكان وضعها

// الرمز "\ لإضافة الرمز " في مكان وضعها.

// يضيف عدة مسافات في مكان وضعها \t : الرمز

//يجعل المحتوى الذي يأتي بعدها ينزل على سطر جديد. \n : الرمز


}

}
106 changes: 75 additions & 31 deletions Lesson 43 - الدرس/App.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,78 @@

public class App{


public class App {
public static void main(String[] args) {

String text = "Coder Shiyar";

StringBuffer textBuffer = new StringBuffer("Coder Shiyar");
textBuffer.append(" is a teacher");
textBuffer.insert(0, "1: ");
textBuffer.replace(0, 2, "YouTube: ");

System.out.println(textBuffer);

// Part 1 - StringBuffer - جزء الأول
// append(String s) يتم استخدامها لإضافة النص
// insert(int offset, String s) يُستخدم لإدراج النص المحدد إلى القيمة الذي يملك المتغير في الموضع الذي تحدده
// replace(int startIndex, int endIndex, String str) يستخدم لإستبدال جزء من النص الذي تحدده بقيمة جديدة تحددها بنفسك



String text = " I like to learn Java with Coder Shiyar ";
text = text.toUpperCase();
// String textUpperCase = text.toUpperCase();
// String textLowerCase = text.toLowerCase();
System.out.println(text);
// System.out.println(textUpperCase);
// System.out.println(textLowerCase);
text = text.trim();
System.out.println(text.length());
}

}







}


/* ---------------------------------------------------------------------------------------------------------
Java String methods - Part 1 الجزء الاول
---------------------------------------------------------------------------------------------------------
1:toUpperCase() Converts a string to lower case letters - تحويل الاحرف النص إلى الاحرف الكبيرة
2:toLowerCase() Converts a string to upper case letters - تحويل الاحرف النص إلى الاحرف الصغيرة
3:length() Returns the length of a specified string. يعيد طول نص المحدد
4:trim() Removes whitespace from both ends of a string يزيل المسافة البيضاء من طرفي النص
----------------------------------------------------------------------------------------------------------
Java String methods - Part 2 الجزء الثاني
----------------------------------------------------------------------------------------------------------
1: String replace(oldChar, newChar) يقوم بإستبداول قيمة يطابق مع الجزء المحدد من النص , بالجزء جديد
Searches a string for a specified value, and returns a new string where the specified values are replaced
---------------------------------------------------------------------------------------------------------
2: String substring(int startIndex, int endIndex) يستخدم لقطع نص
This method can be used to cut a string
---------------------------------------------------------------------------------------------------------
3: indexOf() ترجع تمركز الأول للحرف (الأحرف) المحدد في النص المحدد
The indexOf() method returns the position of the first occurrence of specified character(s) in a string
---------------------------------------------------------------------------------------------------------
4: lastIndexOf() ترجع موضع التواجد الأخير للحرف (الأحرف) المحدد في النص المحدد
The lastIndexOf() method returns the position of the last occurrence of specified character(s) in a string
---------------------------------------------------------------------------------------------------------------
Java String methods - Part 3 الجزء الثالث
----------------------------------------------------------------------------------------------------------------
1: equals() يقارن نصين . إرجاع صحيح إذا كانت النصوص متساوية ، وإرجاع خطأ إذا لم يكن كذلك
Compares two strings. Returns true if the strings are equal, and false if not
----------------------------------------------------------------------------------------------------------------
2: equalsIgnoreCase() يقارن نصين مع بعض دون حساسية تحقق من الحالة الاحرف الكبيرة و الصغيرة
Compares two strings, ignoring case considerations
----------------------------------------------------------------------------------------------------------------
3: contains() للتحقق مما إذا كانت النص تحتوي على نص الذي تحدده
Checks whether a string contains a sequence of characters
----------------------------------------------------------------------------------------------------------------
4: isEmpty() يتحقق مما إذا كانت النص فارغة أم لا
The isEmpty() method checks whether a string is empty or not
----------------------------------------------------------------------------------------------------------------
5: startsWith() يستخدم لتحقق إن كان النص يبدأ بجزء الذي تحدده او لا
Checks whether a string starts with specified characters
----------------------------------------------------------------------------------------------------------------
6: endsWith() يستخدم لتحقق إن كان النص ينتهي بجزء الذي تحدده او ل
Checks whether a string ends with the specified character(s)
----------------------------------------------------------------------------------------------------------------
Java String methods - Part 4 الجزء الرابع
----------------------------------------------------------------------------------------------------------------
1:split() : String[] يستخدم لإنشاء قائمة (ارراي) من احد نصوص
Splits a string into an array of substrings
----------------------------------------------------------------------------------------------------------------
2:charAt() : char يستخدم لتحديد الشكل الذي يتواجد في التمركز الذي تحدده ويعيد لك ذلك شكل
Returns the character at the specified index (position)
----------------------------------------------------------------------------------------------------------------
3:valueOf() : String يستخدم لتحويل انواع البيانات الاساسية إلى بيانات بصيغة البيانات النصية
Returns the string representation of the specified value
----------------------------------------------------------------------------------------------------
4:toString() يستخدم لتحويل بيانات من نوع اوبجكت إلى بيانات بصيغة البيانات النصي
A toString() is an in-built method in Java that returns the value given to it in string format.
*/
99 changes: 76 additions & 23 deletions Lesson 44 - الدرس/App.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,82 @@

public class App{


class App {
public static void main(String[] args) {
StringBuffer textBuffer = new StringBuffer("Coder Shiyar Java");
textBuffer.delete(0, 5);
// textBuffer.reverse();
char position10 = textBuffer.charAt(10);
System.out.print(position10);



String text = "I like to learn java with coder shiyar";
String theFirst10 = text.substring(text.length()-12);
int indexOfCoderShiyar = text.indexOf("i");
int lastIndexOfCoderShiyar = text.lastIndexOf("i");
System.out.println(indexOfCoderShiyar);
System.out.println(lastIndexOfCoderShiyar);
System.out.println(theFirst10);
System.out.println(text.replace("1oder shiyar", "Coder Shiyar"));
}

}

// Part 1 - StringBuffer - جزء الأول
// append(String s) يتم استخدامها لإضافة النص
// insert(int offset, String s) يُستخدم لإدراج النص المحدد إلى القيمة الذي يملك المتغير في الموضع الذي تحدده
// replace(int startIndex, int endIndex, String str) يستخدم لإستبدال جزء من النص الذي تحدده بقيمة جديدة تحددها بنفسك


/* ---------------------------------------------------------------------------------------------------------
Java String methods - Part 2 الجزء الثاني
----------------------------------------------------------------------------------------------------------
1: String replace(oldChar, newChar) يقوم بإستبداول قيمة يطابق مع الجزء المحدد من النص , بالجزء جديد
Searches a string for a specified value, and returns a new string where the specified values are replaced
---------------------------------------------------------------------------------------------------------
2: String substring(int startIndex, int endIndex) يستخدم لقطع نص
This method can be used to cut a string
---------------------------------------------------------------------------------------------------------
3: indexOf() ترجع تمركز الأول للحرف (الأحرف) المحدد في النص المحدد
The indexOf() method returns the position of the first occurrence of specified character(s) in a string
---------------------------------------------------------------------------------------------------------
4: lastIndexOf() ترجع موضع التواجد الأخير للحرف (الأحرف) المحدد في النص المحدد
The lastIndexOf() method returns the position of the last occurrence of specified character(s) in a string
*/







/* ---------------------------------------------------------------------------------------------------------
Java String methods - Part 1 الجزء الاول
---------------------------------------------------------------------------------------------------------
1:toUpperCase() Converts a string to lower case letters - تحويل الاحرف النص إلى الاحرف الكبيرة
2:toLowerCase() Converts a string to upper case letters - تحويل الاحرف النص إلى الاحرف الصغيرة
3:length() Returns the length of a specified string. يعيد طول نص المحدد
4:trim() Removes whitespace from both ends of a string يزيل المسافة البيضاء من طرفي النص
---------------------------------------------------------------------------------------------------------------
Java String methods - Part 3 الجزء الثالث
----------------------------------------------------------------------------------------------------------------
1: equals() يقارن نصين . إرجاع صحيح إذا كانت النصوص متساوية ، وإرجاع خطأ إذا لم يكن كذلك
Compares two strings. Returns true if the strings are equal, and false if not
----------------------------------------------------------------------------------------------------------------
2: equalsIgnoreCase() يقارن نصين مع بعض دون حساسية تحقق من الحالة الاحرف الكبيرة و الصغيرة
Compares two strings, ignoring case considerations
----------------------------------------------------------------------------------------------------------------
3: contains() للتحقق مما إذا كانت النص تحتوي على نص الذي تحدده
Checks whether a string contains a sequence of characters
----------------------------------------------------------------------------------------------------------------
4: isEmpty() يتحقق مما إذا كانت النص فارغة أم لا
The isEmpty() method checks whether a string is empty or not
----------------------------------------------------------------------------------------------------------------
5: startsWith() يستخدم لتحقق إن كان النص يبدأ بجزء الذي تحدده او لا
Checks whether a string starts with specified characters
----------------------------------------------------------------------------------------------------------------
6: endsWith() يستخدم لتحقق إن كان النص ينتهي بجزء الذي تحدده او ل
Checks whether a string ends with the specified character(s)
----------------------------------------------------------------------------------------------------------------
Java String methods - Part 4 الجزء الرابع
----------------------------------------------------------------------------------------------------------------
1:split() : String[] يستخدم لإنشاء قائمة (ارراي) من احد نصوص
Splits a string into an array of substrings
----------------------------------------------------------------------------------------------------------------
2:charAt() : char يستخدم لتحديد الشكل الذي يتواجد في التمركز الذي تحدده ويعيد لك ذلك شكل
Returns the character at the specified index (position)
----------------------------------------------------------------------------------------------------------------
3:valueOf() : String يستخدم لتحويل انواع البيانات الاساسية إلى بيانات بصيغة البيانات النصية
Returns the string representation of the specified value
----------------------------------------------------------------------------------------------------
4:toString() يستخدم لتحويل بيانات من نوع اوبجكت إلى بيانات بصيغة البيانات النصي
A toString() is an in-built method in Java that returns the value given to it in string format.
*/


// Part 2 - StringBuffer - جزء الثاني
// delete(int startIndex, int endIndex) يستخدم لحذف جزء من النص , تحدده بنفسك أي جزء ترغب بحذفها
// reverse() يستخدم لعكس النص.
// charAt(int index) يستخدم لإرجاع الحرف في الموضع المحدد.

File renamed without changes.
Loading

0 comments on commit f160878

Please sign in to comment.