Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
closes #386 - escape sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Oct 10, 2023
1 parent 1660fb7 commit 24838a1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/language_concepts/data_types/03_strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,23 @@ fn main() {
assert(message_bytes[0] == message_vec.get(0));
}
```

## Escape characters

You can use escape characters for your strings, as much as escape sequences:

| Escape Sequence | Description |
|-----------------|-----------------|
| `\r` | Carriage Return |
| `\n` | Newline |
| `\t` | Tab |
| `\0` | Null Character |
| `\"` | Double Quote |
| `\\` | Backslash |

Example:

```rust
let s = "Hello \"world" // prints "Hello "world"
let s = "hey \tyou"; // prints "Hello world"
```

0 comments on commit 24838a1

Please sign in to comment.