Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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??



Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: