# Value methods

> Built-in methods you can call directly on Langoost values — string methods, array methods, and numeric methods on int, float, and bool.

# Value methods

Langoost values carry built-in methods, called with dot syntax — `value.method(args)`.
This page lists the methods on each primitive type. (Array methods are covered in
full on the **[arrays](/docs/arrays)** page.)

## String methods

```goost
let s = "  Hello, World  "
println(s.trim().lower())      // "hello, world"
```

| Method | Description |
| --- | --- |
| `len` | Length in bytes |
| `upper()` / `lower()` | Change case |
| `trim([cutset])` / `trimLeft([cutset])` / `trimRight([cutset])` | Trim whitespace or a cutset |
| `split(sep)` | Split into a `string[]` |
| `contains(sub)` | Whether `sub` occurs |
| `hasPrefix(p)` / `hasSuffix(s)` | Prefix / suffix test |
| `startsWith(p)` / `endsWith(s)` | Aliases for the above |
| `replace(old, new)` | Replace all occurrences |
| `replaceFirst(old, new)` | Replace the first occurrence |
| `indexOf(sub)` / `lastIndexOf(sub)` | First / last index (−1 if absent) |
| `slice(start, end)` | Substring `[start, end)` (negative indices allowed) |
| `repeat(n)` | Repeat `n` times |
| `padLeft(width, fill?)` / `padRight(width, fill?)` | Pad to a width |
| `format(...args)` | sprintf-style (`%s`, `%d`, `%f`, `%v`) |
| `toInt()` / `toFloat()` | Parse to a number (0 on failure) |
| `isEmpty()` | Whether the string is empty |

## Array methods

Arrays support `push`, `pop`, `first`, `last`, `slice`, `contains`, `indexOf`,
`join`, `reverse`, `sort`, `flatten`, and the higher-order `map`, `filter`,
`reduce`, `forEach`, `find`, `findIndex`, `every`, and `some`. See
**[arrays](/docs/arrays)** for signatures and examples.

## Number methods

```goost
println((255).toBase(16))      // "ff"
println((-3).abs())            // 3
println((3.9).toInt())         // 3
```

**Int:** `toString()`, `toFloat()`, `toBase(base)`, `abs()`
**Float:** `toString()`, `toInt()` (truncates), `abs()`
**Bool:** `toString()`

Many of these overlap with the global built-ins (`toString`, `toInt`,
`toFloat`) and the **[`strings`](/docs/stdlib/strings)** and
**[`types`](/docs/stdlib/types)** modules — use whichever reads best.