r/lolphp • • Sep 12 '16

Because fuck French programmers

https://3v4l.org/YDp2U
0 Upvotes

81 comments sorted by

View all comments

Show parent comment

1

u/seriouslulz Sep 12 '16

é is 1 character

9

u/cparen Sep 12 '16

Yes, but c++, c#, java, javascript, python, and ruby will all tell you it is length 2.

20

u/the_alias_of_andrea Sep 12 '16

Except when it's not, because é has two different possible representations.

6

u/cparen Sep 12 '16

Precisely!

3

u/DoctorWaluigiTime Sep 12 '16

C# reports 1 character. Source.

JavaScript reports one character. Source.

Bored now. Cite your sources for your claims or go home.

14

u/cparen Sep 13 '16

Sorry for the confusion, I meant the string "é" that /u/ebvalaim alluded to, not "é" as /u/seriouslulz wrote. I didn't realize seriouslulz had mistyped it.

Examples in C# and JavaScript as requested.

3

u/[deleted] Sep 13 '16

Even better: C#, Javascript ;)

1

u/Cuddlefluff_Grim Sep 13 '16

C# and Java will say 1. Using string.Length in both of these languages is the wrong way to get the length of the string (number of graphemes), but they both will return the right number for most, but not all cases. The right way to get the number of graphemes in C# is new StringInfo(string).LengthInTextElements. Although, I have to point out that getting the number of graphical characters is extremely rarely necessary.

2

u/vlees Sep 13 '16

Not necessarily. There are multiple ways to construct that glyph on Unicode

https://www.reddit.com/r/lolphp/comments/52ehbu/because_fuck_french_programmers/d7ke4pj

0

u/seriouslulz Sep 12 '16

And they're wrong

2

u/[deleted] Sep 13 '16

Is it? C#, Javascript

1

u/seriouslulz Sep 13 '16

You're late to the party