设置文本格式
动词:formatText
根据 CPF、CNPJ、PIS、CEP 或信用卡标准,设置输入文本的格式。
语法
formatText --text(String) --texttype(TextFormattingType) (String)=value
输入
| 脚本 | 设计器 | 必需的 | AcceptedTypes | Description |
|---|---|---|---|---|
| -- 文本 | 文本 | 必需的 | 文本 | 要设置格式的输入文本。 |
| --texttype | 类型 | 必需的 | 文本格式设置类型 | 用于设置文本格式的选项。 ; |
输出
| 脚本 | 设计器 | 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".
备注
需要在文本参数中根据格式类型来指定内容。