Logo

Programming-Idioms

History of Idiom 169 > diff from v73 to v74

Edit summary for version 74 by Bart:
[Pascal] The explanition was wrong.

Version 73

2019-09-30, 19:54:45

Version 74

2019-12-01, 11:46:00

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Illustration

Idiom #169 String length

Assign to integer n the number of characters of string s.

This can be different from the number of bytes of s.

Illustration
Extra Keywords
size characters chars number runes
Extra Keywords
size characters chars number runes
Imports
uses sysutils;
Imports
uses sysutils;
Code
n := s.length;
Code
n := s.length;
Comments bubble
Works correctly in Lazarus IDE v. >= 1.8.0.
Comments bubble
Works correctly if s is of type UnicodeString and the string is not encoded using combining characters.
Doc URL
https://www.freepascal.org/docs-html/rtl/sysutils/tstringhelper.length.html
Doc URL
https://www.freepascal.org/docs-html/rtl/sysutils/tstringhelper.length.html