Hacker News new | ask | show | jobs
by HeavyStorm 33 days ago
Oh god why:

> String methods cover case conversion, trimming, searching, splitting, replacing, padding, classification, and parsing. .len() counts Unicode codepoints, not bytes; use .bytes().len() for raw byte length. Indexing with s[i] works in bytes; negative indices count from the end and out-of-bounds returns null. Several methods have aliases: .find() / .index_of(), .ltrim() / .trim_start(), etc.

Indexing uses bytes and len uses codepoints? Are you mad?

weirdUnicode[weirdUnicode.len()-1] returns random char?

And a = "a"; a[1] is null??