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 |
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}/. |
||
⚫ | |||
⚫ | |||
<lang ruby>str = "你好" |
|||
⚫ | |||
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> |
||
⚫ | |||
=={{header|Scala}}== |
=={{header|Scala}}== |