Module | ActiveSupport::CoreExtensions::String::Iterators |
In: |
vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb
|
Custom string iterators
Yields a single-character string for each character in the string. When $KCODE = ‘UTF8’, multi-byte characters are yielded appropriately.
# File vendor/rails/activesupport/lib/active_support/core_ext/string/iterators.rb, line 10 10: def each_char 11: scanner, char = StringScanner.new(self), /./mu 12: loop { yield(scanner.scan(char) || break) } 13: end