Logo

Programming-Idioms

History of Idiom 46 > diff from v33 to v34

Edit summary for version 34 by :
[Pascal] No begin, end. Typo save->safe.

Version 33

2016-02-18, 17:23:39

Version 34

2016-02-24, 15:58:25

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Idiom #46 Extract beginning of string (prefix)

Create string t consisting of the 5 first characters of string s.

Code
var 
  _t, _s: String;
begin
  _t := Copy(_s, 1, 5);
end.
Code
_t := Copy(_s, 1, 5);
Comments bubble
The code is save even if s has less than 5 characters.
Comments bubble
The code is safe even if s has less than 5 characters.