Logo

Programming-Idioms

History of Idiom 169 > diff from v104 to v105

Edit summary for version 105 by programming-idioms.org:
[Ruby] Added Demo URL

Version 104

2022-05-24, 08:42:20

Version 105

2022-06-27, 07:01:40

Idiom #169 String length

Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled.
n can be different from the number of bytes of s.

Idiom #169 String length

Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled.
n can be different from the number of bytes of s.

Variables
n,s
Variables
n,s
Extra Keywords
size characters chars number runes
Extra Keywords
size characters chars number runes
Code
n = s.size
Code
n = s.size
Doc URL
https://ruby-doc.org/core-2.3.0/String.html#method-i-size
Doc URL
https://ruby-doc.org/core-2.3.0/String.html#method-i-size
Demo URL
https://replit.com/@ProgIdioms/AnchoredTreasuredEnvironment#main.rb