Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Character.utf8 field #163

Merged
merged 3 commits into from
Jul 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/cadence/language/values-and-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,21 @@ let c = str[0] // is the Character "a"

`Character` values can be converted into `String` values using the `toString` function:

-
```cadence
let utf8: [UInt8]
```

The byte array of the UTF-8 encoding

```cadence
let a: Character = "a"
let a_bytes = a.utf8 // `a_bytes` is `[97]`

let bouquet: Character = "\u{1F490}"
let bouquet_bytes = bouquet.utf8 // `bouquet_bytes` is `[240, 159, 146, 144]`
```

SupunS marked this conversation as resolved.
Show resolved Hide resolved
-
```cadence
fun toString(): String`
Expand Down