Method: ActiveSupport::CoreExtensions::String::Iterators#each_char
- Defined in:
- lib/active_support/core_ext/string/iterators.rb
#each_char ⇒ Object
Yields a single-character string for each character in the string. When $KCODE = ‘UTF8’, multi-byte characters are yielded appropriately.
14 15 16 17 |
# File 'lib/active_support/core_ext/string/iterators.rb', line 14 def each_char scanner, char = StringScanner.new(self), /./mu loop { yield(scanner.scan(char) || break) } end |