1 point

This is potentially dangerous, as it encourages dealing with text as an array of chars. But graphemes in Unicode, which represent a single symbol in a writing system (such as “H”, “心”, or “💚”), can take up multiple chars in a string. The linked approaches only work if you can guarantee that your string only contains ASCII. See also: The Absolute Minimum Every Software Developer Must Know About Unicode in 2023 (Still No Excuses!)

permalink
report
reply

Yes, good point - I’d forgotten about Unicode in this context.

permalink
report
parent
reply

C Sharp

!csharp@programming.dev

Create post

A community about the C# programming language

Getting started

Useful resources

IDEs and code editors

Tools

Rules

  • Rule 1: Follow Lemmy rules
  • Rule 2: Be excellent to each other, no hostility towards users for any reason
  • Rule 3: No spam of tools/companies/advertisements

Related communities

Community stats

  • 22

    Monthly active users

  • 62

    Posts

  • 32

    Comments