TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why is capitalizing the first letter of a string so convoluted in Rust?

39 pointsby cjgalmost 4 years ago

2 comments

Someonealmost 4 years ago
There’s also Dutch, where ‘ij’ sort-of is a single letter, so capitalizing “ijs” yields “IJs” (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;IJ_(digraph)#Capitalisation" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;IJ_(digraph)#Capitalisation</a>)<p>Unicode has separate code points for those, but their use is discouraged.
评论 #27459525 未加载
inshadowsalmost 4 years ago
I know nothing about Rust, and couldn&#x27;t grok most of what was said in the post, but I&#x27;m curious. Is this all just to please the type system, and will it result in efficient code as if I did the following in C (for some implementation of to_uppercase())?<p><pre><code> c[0] = to_uppercase(c[0]);</code></pre>
评论 #27452569 未加载
评论 #27453747 未加载