Logo

Programming-Idioms

History of Idiom 169 > diff from v105 to v106

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

Version 105

2022-06-27, 07:01:40

Version 106

2022-06-27, 07:01:50

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.length
Code
n = s.length
Doc URL
https://ruby-doc.org/core-2.3.0/String.html#method-i-length
Doc URL
https://ruby-doc.org/core-2.3.0/String.html#method-i-length
Demo URL
https://replit.com/@ProgIdioms/TimelyNovelLanservers#main.rb