Differences

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

Link to this comparison view

Both sides previous revision Previous revision
api:text:zh [2023/10/16 12:30]
hfsr [Text API]
api:text:zh [2023/11/30 09:09] (current)
hfsr [Text(文本) API]
Line 1: Line 1:
 Text(文本) API Text(文本) API
 ======= =======
-此API提供了一些更通用化的操作,用于处理字符串或将数据与字符串相互转化。+此API提供了一些更通用化的操作,用于处理字符串或将数据与字符串相互转化。
  
 - `text.detab(value:​ string, tabWidth: number): string`  ​ - `text.detab(value:​ string, tabWidth: number): string`  ​
-  将字符串中的tab转换为空格,数量为指定的tab宽度。例如,此功能可以用于在使用`term.write`格式化字符串+  将字符串中的tab转换为空格,数量为指定的tab宽度。一个应实例为`term.write`,它用此函数格式化文本。   
 +\\
 - `text.padRight(value:​ string, length: number): string`  ​ - `text.padRight(value:​ string, length: number): string`  ​
-  在字符串右侧填充空格,使其达到指定长度。+  在字符串右侧填充空格,使其达到指定长度。 ​  
 +\\
 - `text.padLeft(value:​ string, length: number): string`  ​ - `text.padLeft(value:​ string, length: number): string`  ​
-  在字符串左侧填充空格,使其达到指定长度。+  在字符串左侧填充空格,使其达到指定长度。 ​  
 +\\
 - `text.trim(value:​ string): string`  ​ - `text.trim(value:​ string): string`  ​
-  移除字符串头尾处的空格。+  移除字符串头尾处的空格。 ​  
 +\\
 - `text.wrap(value:​string,​ width:​number,​ maxWidth:​number)`  ​ - `text.wrap(value:​string,​ width:​number,​ maxWidth:​number)`  ​
-  将给定的字符串按照指定宽度换行。+  将给定的字符串按照指定宽度换行。 ​  
 +\\
 - `text.wrappedLines(value:​string,​ width:​number,​ maxWidth:​number)`  ​ - `text.wrappedLines(value:​string,​ width:​number,​ maxWidth:​number)`  ​
-  返回封装后的`text.wrap`函数。+  返回封装后的`text.wrap`函数。 ​  
 +\\
 - `text.tokenize(value:​string)`  ​ - `text.tokenize(value:​string)`  ​
   将输入的字符串拆分为表,使用空格分隔数据。   将输入的字符串拆分为表,使用空格分隔数据。