设置文本格式

动词:formatText

根据 CPF、CNPJ、PIS、CEP 或信用卡标准,设置输入文本的格式。

语法

formatText --text(String) --texttype(TextFormattingType) (String)=value

输入

脚本 设计器 必需的 AcceptedTypes Description
-- 文本 文本 必需的 文本 要设置格式的输入文本。
--texttype 类型 必需的 文本格式设置类型 用于设置文本格式的选项。
  • CEP(巴西)
  • CNPJ(巴西)
  • CPF(巴西)
  • 信用卡
  • PIS(巴西)
  • ;

    输出

    脚本 设计器 AcceptedTypes Description
    文本 文本 根据所选类型设置了格式的文本。

    示例

    示例 1:将文本内容的格式设置为 CEP(巴西)

    defVar --name textEntry --type String --value 15086260
    defVar --name formattedText --type String
    formatText --text "${textEntry}" --texttype "BrazillianCEP" formattedText=value
    logMessage --message "${formattedText}" --type "Info"
    // This example produces the following result:
    // "15086-260"
    

    示例 2:将文本内容的格式设置为 CPF(巴西)

    defVar --name textEntry --type String --value 08644459899
    defVar --name formattedText --type String
    formatText --text "${textEntry}" --texttype "BrazillianCPF" formattedText=value
    logMessage --message "${formattedText}" --type "Info"
    // This example produces the following result:
    // "086.444.598-99".
    

    备注

    需要在文本参数中根据格式类型来指定内容。

    另请参阅

  • 向正则表达式添加转义字符
  • 向文本添加转义字符
  • 计算散列
  • 更改文本大小写
  • 检查文件
  • 并置文本
  • 将 HTML 转换为文本
  • 计算在文本中的出现次数
  • 文本字符计数
  • 创建随机文本
  • 通过正则表达式创建表
  • 空文本变量或 Null 文本变量
  • 通过正则表达式查找
  • 在文本中查找出现项
  • 获取子文本
  • 通过正则表达式获取文本
  • HTML 转换为 Markdown
  • 向文本插入新行
  • 连接文本
  • 填充文本
  • 解析 URI
  • 除去变音符号
  • 除去转义字符
  • 替换部分文本
  • 替换文本
  • 拆分文本
  • 修剪文本空白