Convert single backtick code sections to triple backtick code sections for Arabic Guide articles (13 of 15) (#36240)
* fix: converted single to triple backticks13 * fix: added prefix Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com> * fix: removed language in wrong place Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com> * fix: add language postfix Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com> * fix: removed language in wrong place Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
		| @@ -10,12 +10,13 @@ localeTitle: طرق سلسلة | ||||
|  | ||||
| يتم إنشاء `string` فارغة باستخدام زوج من علامات الاقتباس أو apostrophes: | ||||
|  | ||||
|  `>>> new_string = ''  | ||||
|  >>> type(new_string)  | ||||
|  <class 'string'>  | ||||
|  >>> len(new_string)  | ||||
|  0  | ||||
| `  | ||||
| ```shell | ||||
| >>> new_string = '' | ||||
| >>> type(new_string) | ||||
| <class 'string'> | ||||
| >>> len(new_string) | ||||
| 0 | ||||
| ```  | ||||
|  | ||||
| [Python Docs - المزيد على سلاسل](https://docs.python.org/3/tutorial/datastructures.html#more-on-strings) | ||||
|  | ||||
|   | ||||
| @@ -12,19 +12,21 @@ localeTitle: طريقة البحث عن سلسلة | ||||
|  | ||||
| مثال: | ||||
|  | ||||
|  `>>> string = "Don't you call me a mindless philosopher, you overweight glob of grease!"  | ||||
|  >>> string.find('you')  | ||||
|  6  | ||||
|  >>> string.rfind('you')  | ||||
|  42  | ||||
| `  | ||||
| ```shell | ||||
| >>> string = "Don't you call me a mindless philosopher, you overweight glob of grease!" | ||||
| >>> string.find('you') | ||||
| 6 | ||||
| >>> string.rfind('you') | ||||
| 42 | ||||
| ```  | ||||
|  | ||||
| إذا لم يتم العثور على السلسلة الفرعية ، يتم إرجاع -1. | ||||
|  | ||||
|  `>>> string = "Don't you call me a mindless philosopher, you overweight glob of grease!"  | ||||
|  >>> string.find('you', 43)  # find 'you' in string anywhere from position 43 to the end of the string  | ||||
|  -1  | ||||
| `  | ||||
| ```shell | ||||
| >>> string = "Don't you call me a mindless philosopher, you overweight glob of grease!" | ||||
| >>> string.find('you', 43)  # find 'you' in string anywhere from position 43 to the end of the string | ||||
| -1 | ||||
| ```  | ||||
|  | ||||
| معلومات اكثر: | ||||
|  | ||||
|   | ||||
| @@ -12,28 +12,33 @@ localeTitle: طريقة الانضمام إلى سلسلة | ||||
|  | ||||
| 1) الانضمام إلى ist من السلاسل مع `":"` | ||||
|  | ||||
|  `print ":".join(["freeCodeCamp", "is", "fun"])  | ||||
| `  | ||||
| ```python | ||||
| print ":".join(["freeCodeCamp", "is", "fun"]) | ||||
| ```  | ||||
|  | ||||
| انتاج | | ||||
|  | ||||
|  `freeCodeCamp:is:fun  | ||||
| `  | ||||
| ```shell | ||||
| freeCodeCamp:is:fun | ||||
| ```  | ||||
|  | ||||
| 2) الانضمام إلى مجموعة من الأوتار مع `" and "` | ||||
|  | ||||
|  `print " and ".join(["A", "B", "C"])  | ||||
| `  | ||||
| ```python | ||||
| print " and ".join(["A", "B", "C"]) | ||||
| ```  | ||||
|  | ||||
| انتاج | | ||||
|  | ||||
|  `A and B and C  | ||||
| `  | ||||
| ```shell | ||||
| A and B and C | ||||
| ```  | ||||
|  | ||||
| 3) أدخل `" "` بعد كل حرف في سلسلة | ||||
|  | ||||
|  `print " ".join("freeCodeCamp")  | ||||
| `  | ||||
| ```python | ||||
| print " ".join("freeCodeCamp") | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
| @@ -48,20 +53,23 @@ localeTitle: طريقة الانضمام إلى سلسلة | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `program  | ||||
| `  | ||||
| ```shell | ||||
| program | ||||
| ```  | ||||
|  | ||||
| 5) الانضمام مع مجموعات. | ||||
|  | ||||
|  `test =  {'2', '1', '3'}  | ||||
|  s = ', '  | ||||
|  print(s.join(test))  | ||||
| `  | ||||
| ```python | ||||
| test =  {'2', '1', '3'} | ||||
| s = ', ' | ||||
| print(s.join(test)) | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `2, 3, 1  | ||||
| `  | ||||
| ```shell | ||||
| 2, 3, 1 | ||||
| ```  | ||||
|  | ||||
| #### معلومات اكثر: | ||||
|  | ||||
|   | ||||
| @@ -10,27 +10,31 @@ localeTitle: طريقة استبدال السلاسل | ||||
|  | ||||
| 1.  استبدال كافة تكرارات `"is"` بـ `"WAS"` | ||||
|  | ||||
|  `string = "This is nice. This is good."  | ||||
|  newString = string.replace("is","WAS")  | ||||
|  print(newString)  | ||||
| `  | ||||
| ```python | ||||
| string = "This is nice. This is good." | ||||
| newString = string.replace("is","WAS") | ||||
| print(newString) | ||||
| ```  | ||||
|  | ||||
| انتاج | | ||||
|  | ||||
|  `ThWAS WAS nice. ThWAS WAS good.  | ||||
| `  | ||||
| ```python | ||||
| ThWAS WAS nice. ThWAS WAS good. | ||||
| ```  | ||||
|  | ||||
| 2.  استبدال أول تكرارين لـ `"is"` بـ `"WAS"` | ||||
|  | ||||
|  `string = "This is nice. This is good."  | ||||
|  newString = string.replace("is","WAS", 2)  | ||||
|  print(newString)  | ||||
| `  | ||||
| ```python | ||||
| string = "This is nice. This is good." | ||||
| newString = string.replace("is","WAS", 2) | ||||
| print(newString) | ||||
| ```  | ||||
|  | ||||
| انتاج | | ||||
|  | ||||
|  `ThWAS WAS nice. This is good.  | ||||
| `  | ||||
| ```python | ||||
| ThWAS WAS nice. This is good. | ||||
| ```  | ||||
|  | ||||
| #### معلومات اكثر: | ||||
|  | ||||
|   | ||||
| @@ -18,58 +18,68 @@ localeTitle: طريقة تقسيم السلسلة | ||||
|  | ||||
| 1) سلسلة الانقسام في الفضاء: "" | ||||
|  | ||||
|  `string = "freeCodeCamp is fun."  | ||||
|  print(string.split(" "))  | ||||
| `  | ||||
| ```python | ||||
| string = "freeCodeCamp is fun." | ||||
| print(string.split(" ")) | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `['freeCodeCamp', 'is', 'fun.']  | ||||
| `  | ||||
| ```python | ||||
| ['freeCodeCamp', 'is', 'fun.'] | ||||
| ```  | ||||
|  | ||||
| 2) سلسلة الانقسام في الفاصلة: "،" | ||||
|  | ||||
|  `string = "freeCodeCamp,is fun, and informative"  | ||||
|  print(string.split(","))  | ||||
| `  | ||||
| ```python | ||||
| string = "freeCodeCamp,is fun, and informative" | ||||
| print(string.split(",")) | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `['freeCodeCamp', 'is fun', ' and informative']  | ||||
| `  | ||||
| ```python | ||||
| ['freeCodeCamp', 'is fun', ' and informative'] | ||||
| ```  | ||||
|  | ||||
| 3) لا يوجد `separator` محدد | ||||
|  | ||||
|  `string = "freeCodeCamp is fun and informative"  | ||||
|  print(string.split())  | ||||
| `  | ||||
| ```python | ||||
| string = "freeCodeCamp is fun and informative" | ||||
| print(string.split()) | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `['freeCodeCamp', 'is', 'fun', 'and', 'informative']  | ||||
| `  | ||||
| ```python | ||||
| ['freeCodeCamp', 'is', 'fun', 'and', 'informative'] | ||||
| ```  | ||||
|  | ||||
| ملاحظة: إذا لم يتم تحديد `separator` ، فسيتم تجريد السلسلة من **جميع** المسافات البيضاء | ||||
|  | ||||
|  `string = "freeCodeCamp        is     fun and    informative"  | ||||
|  print(string.split())  | ||||
| `  | ||||
| ```python | ||||
| string = "freeCodeCamp        is     fun and    informative" | ||||
| print(string.split()) | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `['freeCodeCamp', 'is', 'fun', 'and', 'informative']  | ||||
| `  | ||||
| ```python | ||||
| ['freeCodeCamp', 'is', 'fun', 'and', 'informative'] | ||||
| ```  | ||||
|  | ||||
| 3) تقسيم السلسلة باستخدام `maxsplit` . هنا نقسم السلسلة على "" مرتين: | ||||
|  | ||||
|  `string = "freeCodeCamp is fun and informative"  | ||||
|  print(string.split(" ", 2))  | ||||
| `  | ||||
| ```python | ||||
| string = "freeCodeCamp is fun and informative" | ||||
| print(string.split(" ", 2)) | ||||
| ```  | ||||
|  | ||||
| انتاج: | ||||
|  | ||||
|  `['freeCodeCamp', 'is', 'fun and informative']  | ||||
| `  | ||||
| ```python | ||||
| ['freeCodeCamp', 'is', 'fun and informative'] | ||||
| ```  | ||||
|  | ||||
| #### معلومات اكثر | ||||
|  | ||||
|   | ||||
| @@ -10,24 +10,26 @@ localeTitle: طريقة قطاع سترينج | ||||
|  | ||||
| مثال: | ||||
|  | ||||
|  `>>> string = '   Hello, World!    '  | ||||
|  >>> strip_beginning = string.lstrip()  | ||||
|  >>> strip_beginning  | ||||
|  'Hello, World!    '  | ||||
|  >>> strip_end = string.rstrip()  | ||||
|  >>> strip_end  | ||||
|  '   Hello, World!'  | ||||
|  >>> strip_both = string.strip()  | ||||
|  >>> strip_both  | ||||
|  'Hello, World!'  | ||||
| `  | ||||
| ```py | ||||
| >>> string = '   Hello, World!    ' | ||||
| >>> strip_beginning = string.lstrip() | ||||
| >>> strip_beginning | ||||
| 'Hello, World!    ' | ||||
| >>> strip_end = string.rstrip() | ||||
| >>> strip_end | ||||
| '   Hello, World!' | ||||
| >>> strip_both = string.strip() | ||||
| >>> strip_both | ||||
| 'Hello, World!' | ||||
| ```  | ||||
|  | ||||
| يمكن تقديم وسيطة اختيارية كسلسلة تحتوي على كل الحروف التي ترغب في تجريدها. | ||||
|  | ||||
|  `>>> url = 'www.example.com/'  | ||||
|  >>> url.strip('w./')  | ||||
|  'example.com'  | ||||
| `  | ||||
| ```py | ||||
| >>> url = 'www.example.com/' | ||||
| >>> url.strip('w./') | ||||
| 'example.com' | ||||
| ```  | ||||
|  | ||||
| ومع ذلك ، هل لاحظ أن الأول فقط `.` جردت من الخيط ويرجع ذلك إلى أن وظيفة `strip` فقط بتمييز أحرف الوسيطة الموجودة على اليسار أو أقصى اليمين. منذ w يأتي قبل الأول `.` يتم تجريدهم معا، بينما "com" موجود في النهاية الصحيحة قبل `.` بعد تجريد `/` | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user