-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
789dd30
commit 9ff77c4
Showing
3 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
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) يستخدم لإستبدال جزء من النص الذي تحدده بقيمة جديدة تحددها بنفسك | ||
|
||
|
||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
public 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); | ||
|
||
|
||
|
||
} | ||
|
||
} | ||
|
||
// Part 1 - StringBuffer - جزء الأول | ||
// append(String s) يتم استخدامها لإضافة النص | ||
// insert(int offset, String s) يُستخدم لإدراج النص المحدد إلى القيمة الذي يملك المتغير في الموضع الذي تحدده | ||
// replace(int startIndex, int endIndex, String str) يستخدم لإستبدال جزء من النص الذي تحدده بقيمة جديدة تحددها بنفسك | ||
|
||
|
||
|
||
// Part 2 - StringBuffer - جزء الثاني | ||
// delete(int startIndex, int endIndex) يستخدم لحذف جزء من النص , تحدده بنفسك أي جزء ترغب بحذفها | ||
// reverse() يستخدم لعكس النص. | ||
// charAt(int index) يستخدم لإرجاع الحرف في الموضع المحدد. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
public class App{ | ||
|
||
|
||
public static void main(String[] args) { | ||
StringBuffer text = new StringBuffer("Coder"); | ||
int length = text.length(); | ||
text.append(" Shiyar"); | ||
text.delete(0, 6); | ||
text.insert(0, " I love "); | ||
text.append(text.charAt(0) + ": "); | ||
|
||
if(text.length() >= 12){ | ||
|
||
String textSubstring = text.substring(0); | ||
|
||
System.out.print(textSubstring); | ||
}else{ | ||
System.out.print("التمركز الذي قمت بتحديدها , لا يتوجد بسبب عدد احرف في البيانات المتغير , يكون أقل من تمركز الذي قمت بتحديدها"); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
// Part 1 - StringBuffer - جزء الأول | ||
// append(String s) يتم استخدامها لإضافة النص | ||
// insert(int offset, String s) يُستخدم لإدراج النص المحدد إلى القيمة الذي يملك المتغير في الموضع الذي تحدده | ||
// replace(int startIndex, int endIndex, String str) يستخدم لإستبدال جزء من النص الذي تحدده بقيمة جديدة تحددها بنفسك | ||
|
||
|
||
|
||
// Part 2 - StringBuffer - جزء الثاني | ||
// delete(int startIndex, int endIndex) يستخدم لحذف جزء من النص , تحدده بنفسك أي جزء ترغب بحذفها | ||
// reverse() يستخدم لعكس النص. | ||
// charAt(int index) يستخدم لإرجاع الحرف في الموضع المحدد. | ||
|
||
|
||
// Part 3 - StringBuffer - جزء الثالث | ||
// length() تُستخدم لإرجاع طول النص ، أي العدد الإجمالي للأحرف. | ||
// substring(int beginIndex) يقوم بإعادة لك القيمة الذي يملكه المتغير ابتداء من تمركز الذي تحدده | ||
|
||
// يقوم بإعادة لك القيمة الذي يملكه المتغير ابتداء من تمركز الذي تحدده إلى تمركز الذي تقوم بتحديدها | ||
// substring(int beginIndex, int endIndex) | ||
|
||
|
||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|