Files
Claro/docs/STDLIB.md
T

57 lines
797 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Claro Standard Library (Commands)
Claro’s “stdlib” is exposed as readable commands.
## TEXT
### Split
```claro
TEXT SPLIT "a,b,c" BY "," AS parts
```
### Join
```claro
TEXT JOIN parts BY "-" AS out
```
### Replace all
```claro
TEXT REPLACE "one two two" FROM "two" TO "three" AS out
```
## PATH
### Dirname
```claro
PATH DIRNAME "C:/games/save/file.txt" AS dir
```
### Normalize
Unifies slashes and removes `.` / `..` where possible:
```claro
PATH NORMALIZE "../data/./levels/../sprites" AS clean
```
### Is absolute
```claro
PATH ISABS "/home/me/file.txt" AS isAbs
```
### Exists
Checks if a file exists at the path:
```claro
PATH EXISTS "config.json" AS ok
```
## TIME
### Unix seconds
```claro
TIME NOW AS t
```
### Unix milliseconds (coarse)
```claro
TIME NOWMS AS ms
```