Unicode strings: Difference between revisions

Content added Content deleted
(→‎{{header|Go}}: Update info on normalization support; add link to highly relevant official Go blog article; other tweaks)
(→‎{{header|Ruby}}: Made more clear that it is easy to use Unicode, even without specific support.)
Line 870: Line 870:


=={{header|Ruby}}==
=={{header|Ruby}}==
Ruby has hardly any support for Unicode; it focusses on encodings (exactly 100 encodings are supported in Ruby 2.1.0, the default being UTF-8 since 2.1.0).
Ruby has hardly any specific support for Unicode; however since it focuses on encodings (exactly 100 encodings are supported in Ruby 2.1.0) it includes pretty much all known Unicode Transformation Formats, including UTF-8 which is the default encoding since 2.1.0 .


Most support is to be found in the Regexp engine, for instance /\p{Sc}/ matches everything from the Symbol: Currency category; \p{} matches a character’s Unicode script, like /\p{Linear_B}/.
Most support is to be found in the Regexp engine, for instance /\p{Sc}/ matches everything from the Symbol: Currency category; \p{} matches a character’s Unicode script, like /\p{Linear_B}/.


Unicode strings are no problem:
The unicode gem (an external library) is for difficult things like normalization and lowercase\uppercase outside the ASCII region.


<lang ruby>str = "你好"
Unicode code is no problem:
str.include?("好") # => true</lang>

Unicode code is no problem either:


<lang ruby>def Σ(array)
<lang ruby>def Σ(array)
Line 884: Line 887:
puts Σ([4,5,6]) #=>15
puts Σ([4,5,6]) #=>15
</lang>
</lang>
The unicode gem (an external library) is for difficult things like normalization and lowercase\uppercase outside the ASCII region.


=={{header|Scala}}==
=={{header|Scala}}==