fix: converted single to triple backticks11 (#36238)
This commit is contained in:
@@ -8,14 +8,16 @@ localeTitle: String.prototype.endsWith
|
||||
|
||||
### فمثلا
|
||||
|
||||
`let str = "Hello world";
|
||||
let bool = str.endsWith("ld") // true
|
||||
bool = str.endsWith("llo") // false
|
||||
`
|
||||
```js
|
||||
let str = "Hello world";
|
||||
let bool = str.endsWith("ld") // true
|
||||
bool = str.endsWith("llo") // false
|
||||
```
|
||||
|
||||
يمكن أن تقبل هذه الطريقة أيضًا معلمة أخرى ، وهي `length` الذي يحدد قبل أي حرف للبحث في السلسلة.
|
||||
|
||||
`let str = "Hello world";
|
||||
let bool = str.endsWith("ld", 5) // false, it's the same as "Hello".endsWith("ld")
|
||||
bool = str.endsWith("llo", 5) // true, it's the same as "Hello".endsWith("llo")
|
||||
`
|
||||
```js
|
||||
let str = "Hello world";
|
||||
let bool = str.endsWith("ld", 5) // false, it's the same as "Hello".endsWith("ld")
|
||||
bool = str.endsWith("llo", 5) // true, it's the same as "Hello".endsWith("llo")
|
||||
```
|
@@ -14,8 +14,9 @@ localeTitle: String.prototype.includes
|
||||
|
||||
**بناء الجملة**
|
||||
|
||||
`string.includes(searchString[, position])
|
||||
`
|
||||
```js
|
||||
string.includes(searchString[, position])
|
||||
```
|
||||
|
||||
**المعلمات**
|
||||
|
||||
@@ -23,30 +24,35 @@ localeTitle: String.prototype.includes
|
||||
|
||||
**أمثلة**
|
||||
|
||||
`let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('red'); // returns true
|
||||
`
|
||||
```js
|
||||
let string = "Roses are red, violets are blue.";
|
||||
|
||||
`let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('Red'); // returns false
|
||||
`
|
||||
string.includes('red'); // returns true
|
||||
```
|
||||
|
||||
`let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('red',12); // returns false because 'red' starts at position 9, and our search begins at position 12.
|
||||
`
|
||||
```javascript
|
||||
let string = "Roses are red, violets are blue.";
|
||||
|
||||
`let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('blue',12); // returns true because 'blue' starts after our search begins at position 12.
|
||||
`
|
||||
string.includes('Red'); // returns false
|
||||
```
|
||||
|
||||
`let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('violets are blue'); // returns true
|
||||
`
|
||||
```javascript
|
||||
let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('red',12); // returns false because 'red' starts at position 9, and our search begins at position 12.
|
||||
```
|
||||
|
||||
```javascript
|
||||
let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('blue',12); // returns true because 'blue' starts after our search begins at position 12.
|
||||
```
|
||||
|
||||
```javascript
|
||||
let string = "Roses are red, violets are blue.";
|
||||
|
||||
string.includes('violets are blue'); // returns true
|
||||
```
|
||||
|
||||
#### معلومات اكثر:
|
||||
|
||||
|
@@ -8,8 +8,9 @@ localeTitle: String.prototype.indexOf
|
||||
|
||||
**بناء الجملة**
|
||||
|
||||
`str.indexOf(searchValue[, fromIndex])
|
||||
`
|
||||
```javascript
|
||||
str.indexOf(searchValue[, fromIndex])
|
||||
```
|
||||
|
||||
### المعلمات
|
||||
|
||||
@@ -24,17 +25,18 @@ localeTitle: String.prototype.indexOf
|
||||
|
||||
### أمثلة
|
||||
|
||||
`'Blue Whale'.indexOf('Blue'); // returns 0
|
||||
'Blue Whale'.indexOf('Blute'); // returns -1
|
||||
'Blue Whale'.indexOf('Whale', 0); // returns 5
|
||||
'Blue Whale'.indexOf('Whale', 5); // returns 5
|
||||
'Blue Whale'.indexOf('Whale', 7); // returns -1
|
||||
'Blue Whale'.indexOf(''); // returns 0
|
||||
'Blue Whale'.indexOf('', 9); // returns 9
|
||||
'Blue Whale'.indexOf('', 10); // returns 10
|
||||
'Blue Whale'.indexOf('', 11); // returns 10
|
||||
'Blue Whale'.indexOf('blue'); // returns -1
|
||||
`
|
||||
```javascript
|
||||
'Blue Whale'.indexOf('Blue'); // returns 0
|
||||
'Blue Whale'.indexOf('Blute'); // returns -1
|
||||
'Blue Whale'.indexOf('Whale', 0); // returns 5
|
||||
'Blue Whale'.indexOf('Whale', 5); // returns 5
|
||||
'Blue Whale'.indexOf('Whale', 7); // returns -1
|
||||
'Blue Whale'.indexOf(''); // returns 0
|
||||
'Blue Whale'.indexOf('', 9); // returns 9
|
||||
'Blue Whale'.indexOf('', 10); // returns 10
|
||||
'Blue Whale'.indexOf('', 11); // returns 10
|
||||
'Blue Whale'.indexOf('blue'); // returns -1
|
||||
```
|
||||
|
||||
### معلومات اكثر:
|
||||
|
||||
|
@@ -12,26 +12,28 @@ localeTitle: String.prototype.split
|
||||
|
||||
أمثلة:
|
||||
|
||||
`// We have a regular string
|
||||
"Hello. I am a string. You can separate me."
|
||||
|
||||
// Let's use the split function to separate the string by the period character:
|
||||
"Hello. I am a string. You can separate me.".split(".");
|
||||
// output is [ "Hello", " I am a string", " You can separate me", "" ]
|
||||
`
|
||||
```js
|
||||
// We have a regular string
|
||||
"Hello. I am a string. You can separate me."
|
||||
|
||||
// Let's use the split function to separate the string by the period character:
|
||||
"Hello. I am a string. You can separate me.".split(".");
|
||||
// output is [ "Hello", " I am a string", " You can separate me", "" ]
|
||||
```
|
||||
|
||||
بما أننا استخدمنا النقطة ( `.` ) _كسلسلة فاصلة_ ، فإن السلاسل في صفيف الخرج لا تحتوي على الفترة الموجودة فيها ؛ _لا تتضمن_ سلاسل فصل الإخراج _سلسلة سلسلة فاصل الإدخال نفسه_ .
|
||||
|
||||
ليس من الضروري أن يكون _فاصل السلسلة_ حرفًا واحدًا ، يمكن أن يكون أي سلسلة أخرى:
|
||||
|
||||
`"Hello... I am another string... keep on learning!".split("...");
|
||||
// output is [ "Hello", " I am another string", " keep on learning!" ]
|
||||
|
||||
const names = "Kratos- Atreus- Freya- Hela- Thor- Odin";
|
||||
// notice separator is a dash and a space
|
||||
names.split("- ");
|
||||
// output is [ "Kratos", "Atreus", "Freya", "Hela", "Thor", "Odin" ]
|
||||
`
|
||||
```js
|
||||
"Hello... I am another string... keep on learning!".split("...");
|
||||
// output is [ "Hello", " I am another string", " keep on learning!" ]
|
||||
|
||||
const names = "Kratos- Atreus- Freya- Hela- Thor- Odin";
|
||||
// notice separator is a dash and a space
|
||||
names.split("- ");
|
||||
// output is [ "Kratos", "Atreus", "Freya", "Hela", "Thor", "Odin" ]
|
||||
```
|
||||
|
||||
#### معلومات اكثر:
|
||||
|
||||
|
@@ -17,14 +17,16 @@ localeTitle: String.prototype.substr
|
||||
|
||||
#### أمثلة:
|
||||
|
||||
`let str = "Hello world!";
|
||||
let res = str.substr(1, 4);
|
||||
`
|
||||
```JavaScript
|
||||
let str = "Hello world!";
|
||||
let res = str.substr(1, 4);
|
||||
```
|
||||
|
||||
ستكون نتيجة الدقة:
|
||||
|
||||
`ello
|
||||
`
|
||||
```
|
||||
ello
|
||||
```
|
||||
|
||||
#### معلومات اكثر:
|
||||
|
||||
|
@@ -10,18 +10,20 @@ localeTitle: String.prototype.substring
|
||||
|
||||
أمثلة:
|
||||
|
||||
`"Hello, campers".substring(7, 14);
|
||||
// output is "campers"
|
||||
|
||||
"Hello, world".substring(0, 5);
|
||||
// output is "Hello"
|
||||
`
|
||||
```js
|
||||
"Hello, campers".substring(7, 14);
|
||||
// output is "campers"
|
||||
|
||||
"Hello, world".substring(0, 5);
|
||||
// output is "Hello"
|
||||
```
|
||||
|
||||
يمكنك أيضًا حذف معلمة فهرس الأحرف الأخيرة ، وسيتم استخراج التسلسل الفرعي من فهرس البدء حتى نهاية السلسلة. مثال:
|
||||
|
||||
`"Hello, campers!".substring(7);
|
||||
// output is "campers!"
|
||||
`
|
||||
```js
|
||||
"Hello, campers!".substring(7);
|
||||
// output is "campers!"
|
||||
```
|
||||
|
||||
#### معلومات اكثر:
|
||||
|
||||
|
@@ -8,9 +8,10 @@ localeTitle: String.prototype.trim
|
||||
|
||||
أمثلة:
|
||||
|
||||
`" Hello, campers. I have spaces on both ends! ".trim();
|
||||
// output is "Hello, campers. I have spaces on both ends!"
|
||||
`
|
||||
```js
|
||||
" Hello, campers. I have spaces on both ends! ".trim();
|
||||
// output is "Hello, campers. I have spaces on both ends!"
|
||||
```
|
||||
|
||||
`trim()` لا يزيل فقط أحرف الفضاء. يزيل أي حرف مسافة بيضاء ، مثل علامات التبويب ، فواصل الأسطر ، فواصل عدم الانكسار ، إلخ.
|
||||
|
||||
|
Reference in New Issue
Block a user