Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 354 Bytes

File metadata and controls

18 lines (12 loc) · 354 Bytes

Count characters of a string in Ruby

Code points

The length or size methods are available for String objects.

count = str.length
count = str.size

Grapheme clusters

The core language does not provide a way to count grapheme clusters. If you know of a library with this functionality, please contribute it here.