Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
api:text:zh [2022/08/11 10:48]
fight_xing created
api:text:zh [2023/11/30 09:09] (current)
hfsr [Text(文本) API]
Line 1: Line 1:
-Text API+Text(文本) ​API
 ======= =======
- +此API提供了一些更通用化操作,可用于处理字符串或将数据与字符串相互转化
-**本篇文章部分/​全部内容还没有进行翻译** +
- +
-This API provides some more general operations on strings and data serialization into and back from strings.+
  
 - `text.detab(value:​ string, tabWidth: number): string`  ​ - `text.detab(value:​ string, tabWidth: number): string`  ​
-  ​Converts tabs in a string to spaces, while aligning the tags at the specified ​tab width. This is used for formatting text in `term.write`, for example.+  ​将字符串中的tab转换为空格,数量为指定的tab宽度。一个应用实例为`term.write`,它用此函数格式化文本。 ​  
 +\\
 - `text.padRight(value:​ string, length: number): string`  ​ - `text.padRight(value:​ string, length: number): string`  ​
-  ​Pads a string with whitespace on the right up to the specified length.+  ​在字符串右侧填充空格,使其达到指定长度。 ​  
 +\\
 - `text.padLeft(value:​ string, length: number): string`  ​ - `text.padLeft(value:​ string, length: number): string`  ​
-  ​Pads a string with whitespace on the left up to the specified length.+  ​在字符串左侧填充空格,使其达到指定长度。 ​  
 +\\
 - `text.trim(value:​ string): string`  ​ - `text.trim(value:​ string): string`  ​
-  ​Removes whitespace characters from the start and end of a string.+  ​移除字符串头尾处的空格。 ​  
 +\\
 - `text.wrap(value:​string,​ width:​number,​ maxWidth:​number)`  ​ - `text.wrap(value:​string,​ width:​number,​ maxWidth:​number)`  ​
-  ​Wraps the provided string to specified width.+  ​将给定的字符串按照指定宽度换行。 ​  
 +\\
 - `text.wrappedLines(value:​string,​ width:​number,​ maxWidth:​number)`  ​ - `text.wrappedLines(value:​string,​ width:​number,​ maxWidth:​number)`  ​
-  ​Returns a wrapper function around ​`text.wrap`.+  ​返回封装后的`text.wrap`函数。 ​  
 +\\
 - `text.tokenize(value:​string)`  ​ - `text.tokenize(value:​string)`  ​
-  ​Splits the input string into a table, using space as the delimiter.+  ​将输入的字符串拆分为表,使用空格分隔数据。
  
 目录 目录
 ---------- ----------
 {{page>​api:​contents:​zh&​noheader&​noeditbutton&​nouser&​nofooter}} {{page>​api:​contents:​zh&​noheader&​noeditbutton&​nouser&​nofooter}}