Sometimes string manipulation can go wrong in strange ways. So it's good to know that there are alternative versions for some of these methods.
For example, the toLocalUpperCase and toLocalLowerCase methods property capitalize languages (other than, e.g., English) which can have some unexpected casing rules.
Also, some Unicode glyphs need multiple character codes. If you're working with languages (and not hashing or encoding), you may want to reach for the codePointAt method, which handles this type of glyph correctly. If splitting or reversing a string isn't working as you'd expect, keep this method in mind.
Depending on your audience and local, you may never need to reach for these methods. As your audience grows, though, using them can solve a number of strange and hard to understand bugs in string manipulation.
Thanks for the useful reply. This post is meant to be an introduction of the methods I used more on solving coding problems, but I am surely going to integrate it even with your suggestions. Have a nice day!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great introduction, Mauro!
Sometimes string manipulation can go wrong in strange ways. So it's good to know that there are alternative versions for some of these methods.
For example, the
toLocalUpperCase
andtoLocalLowerCase
methods property capitalize languages (other than, e.g., English) which can have some unexpected casing rules.Also, some Unicode glyphs need multiple character codes. If you're working with languages (and not hashing or encoding), you may want to reach for the
codePointAt
method, which handles this type of glyph correctly. If splitting or reversing a string isn't working as you'd expect, keep this method in mind.Depending on your audience and local, you may never need to reach for these methods. As your audience grows, though, using them can solve a number of strange and hard to understand bugs in string manipulation.
Cheers!
Thanks for the useful reply. This post is meant to be an introduction of the methods I used more on solving coding problems, but I am surely going to integrate it even with your suggestions. Have a nice day!