this post was submitted on 02 Oct 2023
2 points (100.0% liked)

Programming

20182 readers
213 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] [email protected] -1 points 2 years ago

currency symbols other than the $ (kind of tells you who invented computers, doesn’t it?)

Who wants to tell the author that not everything was invented in the US? (And computers certainly weren't)

[–] [email protected] 0 points 2 years ago* (last edited 2 years ago) (1 children)

I love the comparison of string length of the same UTF-8 string in four programming languages (only the last one is correct, by the way):

Python 3:

len("🤦🏼‍♂️")

5

JavaScript / Java / C#:

"🤦🏼‍♂️".length

7

Rust:

println!("{}", "🤦🏼‍♂️".len());

17

Swift:

print("🤦🏼‍♂️".count)

1

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago)

That depends on your definition of correct lmao. Rust explicitly counts utf-8 scalar values, because that's the length of the raw bytes contained in the string. There are many times where that value is more useful than the grapheme count.

[–] [email protected] 1 points 2 years ago* (last edited 2 years ago)

Now this is UX. Wonderful stuff.

Screenshot of the page showing me 20 mouse cursors moving across the page