diff --git a/README.adoc b/README.adoc index bcdc28c8c..d875f2bbd 100644 --- a/README.adoc +++ b/README.adoc @@ -4487,6 +4487,20 @@ url.sub('http://', 'https://') str.tr('-', '_') ---- +=== `String#chars` [[string-chars]] + +Prefer the use of `String#chars` over `String#split` with empty string or regexp literal argument. + +[source,ruby] +---- +# bad +string.split(//) +string.split('') + +# good +string.chars +---- + === `sprintf` [[sprintf]] Prefer the use of `sprintf` and its alias `format` over the fairly cryptic `String#%` method.