Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.
Scope and conventions
TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.
trim borrows a trimmed view. split_whitespace yields an iterator; next returns Option. len counts bytes; chars visits Unicode scalar values. String supports push, pop and clear; &str does not mutate owned text.
Fragment
Independent fragments inside a function.
src/main.rs
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
let mut words = "north west".split_whitespace();let first = words.next();let clean = " west ".trim();let empty = clean.is_empty();
Double quotes produce borrowed string literals; single quotes produce char values. Raw string literals preserve backslashes. String::from or to_owned creates owned, growable text.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
str/String contain valid UTF-8; len counts bytes and chars visits Unicode scalar values. Integer character indexing is not supported. Byte slicing must land on UTF-8 boundaries; scalar values are not grapheme clusters.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
src/main.rs
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
let text = "🦀";let bytes = text.len(); // 4let scalars = text.chars().count(); // 1
String owns mutable UTF-8 text; push adds one char, push_str adds borrowed text. replace returns a new String rather than modifying the original. &str is a borrowed view, not a growable buffer.
Fragment
Fragment: imports and type/function declarations at file scope; usage statements inside a function.
src/main.rs
Follow appearance
✓GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
let mut text = String::from("north");text.push(' ');text.push_str("gate");let changed = text.replace("north", "west");