3 ms·
> as in they should things you can just use by-default without thinking about it That time has passed. If you want to know the length of a string, you really s
by toast0 3y ago
> as in they should things you can just use by-default without thinking about it
That time has passed. If you want to know the length of a string, you really should indicate what length type you mean.
- hot_gril 3y agoThere was no string.length in Swift for a while. Then they added one that just does what the user expects, get the number of grapheme clusters. If a user figures out that this isn't what they want, they can go use the other length method.
- dathinab 3y agoexcept if it's server swift code, then it doesn't do what the user expects at all
- hot_gril 3y agoThe most common reason I can think of a server wanting the string length is because it's enforcing a character limit in some field, in which case it does what the user expects. You aren't often manually managing memory in Swift. On top of that, Swift on server is probably rare to begin with.