uce/site/doc/pages/list_unique.txt
2026-06-15 11:04:16 +00:00

27 lines
915 B
Plaintext

:title
list_unique
:sig
StringList list_unique(StringList items)
:see
StringList
0_DValue
filter
:content
Returns the first occurrence of each string, preserving input order.
These helpers keep common data-shaping code close to render code, routers, and configuration trees. They are useful for route lists, navigation items, cards, and records that need simple transformations before rendering.
```cpp
auto tags = list_unique({"uce", "docs", "uce"});
```
Prefer these helpers over open-coded loops when the transformation itself is the important part of the code. Use an explicit loop when mutation, error handling, or side effects are the main concern.
## Related Concepts
- JavaScript / React: `Array.map`, `Array.filter`, `Array.find`, object `pick`/`omit`, and grouping route or navigation records before rendering.
- PHP: `array_map`, `array_filter`, `array_unique`, and associative array projection.