> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/code/builtin/data-transformation-functions/strings.md).

# Duaer 字符串上的转换方法

在 Duaer 表达式里，字符串方法做大小写、截取、判断邮箱和网址，以及 base64 和 URL 编解码。
## 判断和取出

- isEmpty()、isNotEmpty()、length：空、不空、长度。
- includes(文字)、startsWith(文字)、indexOf(文字)、search(文字)、match(正则)：是否包含、是否以此开头、位置、搜索、按正则匹配。
- isEmail()、isUrl()、isDomain()、isNumeric()：像不像邮箱、网址、域名、数字。
- extractEmail()、extractUrl()、extractUrlPath()、extractDomain()：从一段文字里取出邮箱、网址、路径或域名。

## 改写和转换

- toLowerCase()、toUpperCase()、toTitleCase()、toSentenceCase()、toSnakeCase()：改大小写或变成蛇形。
- trim()：去掉两端空白。replace(找, 换)、replaceAll(找, 换)：替换。replaceSpecialChars()：处理特殊字符。removeMarkdown()、removeTags()：去掉 Markdown 或 HTML 标签。
- slice(起, 止)、substring(起, 止)、split(分隔符)、concat(另一段)：截取、拆开、接上。
- quote()：加上引号。
- base64Encode()、base64Decode()、urlEncode()、urlDecode()、hash()：编码、解码、哈希。
- parseJson()：把 JSON 字符串解析成对象。toJsonString()：再变成 JSON 字符串。
- toNumber()、toBoolean()、toDateTime()：转成数字、布尔或 DateTime。

```
{{ $json.note.extractEmail() }}
```
## Questions

### 在 Duaer 里 extractEmail 做什么？

在 Duaer 表达式里，从一段字符串里取出邮箱。同类还有 extractUrl()、extractUrlPath()、extractDomain()。isEmail() 只判断像不像邮箱，不取出内容。

### 在 Duaer 里字符串怎么解析成 JSON？

在 Duaer 表达式里，parseJson() 把 JSON 字符串解析成对象或数组；toJsonString() 再变回 JSON 字符串。toNumber()、toBoolean()、toDateTime() 分别转成数字、布尔和 DateTime。

