Add strings
This commit is contained in:
parent
6a7392eff4
commit
0e21bc8408
1 changed files with 8 additions and 5 deletions
|
|
@ -12,11 +12,11 @@ echo "words words words ⚑"
|
||||||
echo """
|
echo """
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<head/>\n\n
|
</head>\n\n
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<body/>
|
</body>
|
||||||
<html/> """
|
</html> """
|
||||||
|
|
||||||
proc re(s: string): string = s
|
proc re(s: string): string = s
|
||||||
|
|
||||||
|
|
@ -37,8 +37,11 @@ words words words ⚑
|
||||||
\b[a-z]++\b
|
\b[a-z]++\b
|
||||||
```
|
```
|
||||||
|
|
||||||
There are several things to note about strings:
|
There are several types of strings literals:
|
||||||
|
|
||||||
- Quoted Strings: Created by wrapping the body in triple quotes, they never interpret escape codes
|
- Quoted Strings: Created by wrapping the body in triple quotes, they never interpret escape codes
|
||||||
- Raw Strings: created by prefixing the string with an `r`. Escape sequences don't work, except for `"`, which can be escaped as `""`
|
- Raw Strings: created by prefixing the string with an `r`. Escape sequences don't work, except for `"`, which can be escaped as `""`
|
||||||
- Proc Strings: raw strings, but the method name that prefixes the string is called
|
- Proc Strings: raw strings, but the method name that prefixes the string is called
|
||||||
|
|
||||||
|
### A note about unicode
|
||||||
|
Unicode symbols are allowed in strings, but are not treated in any special way, so if you want count glyphs or uppercase unicode symbols, you must use the `unicode` module. However, because all unicode characters are above 127, you can safely pretend you are not using unicode.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue