instance method
reorder_characters
Ruby on Rails 3.2.22.5
Since v3.0.20 Last seen in v5.2.8.1Signature
reorder_characters(codepoints)
Re-order codepoints so the string becomes canonical.
Parameters
-
codepointsreq
Source
# File activesupport/lib/active_support/multibyte/unicode.rb, line 130
def reorder_characters(codepoints)
length = codepoints.length- 1
pos = 0
while pos < length do
cp1, cp2 = database.codepoints[codepoints[pos]], database.codepoints[codepoints[pos+1]]
if (cp1.combining_class > cp2.combining_class) && (cp2.combining_class > 0)
codepoints[pos..pos+1] = cp2.code, cp1.code
pos += (pos > 0 ? -1 : 1)
else
pos += 1
end
end
codepoints
end
Defined in activesupport/lib/active_support/multibyte/unicode.rb line 130
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Unicode