Skip to content

Commit 648f442

Browse files
authored
Modification of replace-related methods (#65)
1 parent c535398 commit 648f442

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

docs/basic-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ String is one of the most widely used data types in programming languages, maste
6262
| Concatenate | `myStr1 + myStr2` | `my_str1 + my_str2` |
6363
| Slice | `myStr.slice(start, end)` | `my_str[start:end]` |
6464
| Find | `myStr.indexOf(substring)` | `my_str.index(substring)` |
65-
| Replace | `myStr.replace(old, new)` | `my_str.replace(old, new)` |
65+
| Replace | `myStr.replaceAll(old, new)` | `my_str.replace(old, new)` |
6666
| Split | `myStr.split(separator)` | `my_str.split(separator)` |
6767
| Convert to uppercase and lowercase | `myStr.toUpperCase()`<br />`myStr.toLowerCase()` | `my_str.upper()`<br />`my_str.lower()` |
6868
| Reverse | `myStr.split('').reverse().join('')` | `my_str[::-1]` |

docs/re-module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ In Python, prefixing a string with `r` indicates a raw string literal, which tre
6262
| Matching a regular expression | `myReg.test(myStr)` | `my_regex.match(my_str)` |
6363
| Finding the first match | `myReg.exec(myStr)` | `my_regex.search(my_str)` |
6464
| Finding all matches | `myStr.match(myReg)` | `my_regex.findall(my_str)` |
65-
| Replacing matches | `myStr.replace(myReg, replacement)` | `my_regex.sub(replacement, my_str)` |
65+
| Replacing matches | `myStr.replaceAll(myReg, replacement)` | `my_regex.sub(replacement, my_str)` |
6666
| Splitting a string using a regular expression | `myStr.split(myReg)` | `my_regex.split(my_str)` |
6767

6868
:::tip

i18n/zh-cn/docusaurus-plugin-content-docs/current/basic-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ print(type(name)) # 获取变量的类型
6262
| 拼接 | `myStr1 + myStr2` | `my_str1 + my_str2` |
6363
| 截取 | `myStr.slice(start, end)` | `my_str[start:end]` |
6464
| 查找 | `myStr.indexOf(substring)` | `my_str.index(substring)` |
65-
| 替换 | `myStr.replace(old, new)` | `my_str.replace(old, new)` |
65+
| 替换 | `myStr.replaceAll(old, new)` | `my_str.replace(old, new)` |
6666
| 分割 | `myStr.split(separator)` | `my_str.split(separator)` |
6767
| 大小写转换 | `myStr.toUpperCase()`<br />`myStr.toLowerCase()` | `my_str.upper()`<br />`my_str.lower()` |
6868
| 反转 | `myStr.split('').reverse().join('')` | `my_str[::-1]` |

i18n/zh-cn/docusaurus-plugin-content-docs/current/re-module.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Python 中的字符串前面添加 `r`,表示不对字符串字面量进行转
6363
| 匹配正则表达式 | `myReg.test(myStr)` | `my_regex.match(my_str)` |
6464
| 查找第一个匹配项 | `myReg.exec(myStr)` | `my_regex.search(my_str)` |
6565
| 查找所有匹配项 | `myStr.match(myReg)` | `my_regex.findall(my_str)` |
66-
| 替换匹配项 | `myStr.replace(myReg, replacement)` | `my_regex.sub(replacement, my_str)` |
66+
| 替换匹配项 | `myStr.replaceAll(myReg, replacement)` | `my_regex.sub(replacement, my_str)` |
6767
| 使用正则表达式拆分字符串 | `myStr.split(myReg)` | `my_regex.split(my_str)` |
6868

6969
:::tip

0 commit comments

Comments
 (0)