Rails, Alphabet range ('a' .. 'z') for non-English characters

('a' .. 'z') and other usage methods available very conveniently.

Is there an equivalent or some other range method for displaying non-english alphabets? (example of the German alphabet (umlaut characters), Turkish alphabet)

UPDATE
My use case:
I generate random strings from alphabets. Therefore, I need all the characters in the alphabet before randomizing and re-attaching them to the specified length. In English I can do: ('a'..'z').to_a.shuffle[0, length].join.capitalize. I want to do the same for other alphabets.

+4
source share
1

. , , "o ". :

'ö'.codepoints
#⇒ [
#  [0] 246
# ]'ö'.codepoints
#⇒ [
#  [0] 111,
#  [1] 776
# ]

, ? , , ISO-8859-1, - "o" + . icu library, ( .)

UPD @NeilSlater , , , -, :

[*('a'..'z'), 'ö', 'ä', 'ü']
+4

Source: https://habr.com/ru/post/1605696/


All Articles