Logo

Programming-Idioms

History of Idiom 46 > diff from v8 to v9

Edit summary for version 9 by :

Version 8

2015-08-21, 23:22:26

Version 9

2015-08-22, 21:07:45

Idiom #46 Extract beginning of string (prefix)

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

Idiom #46 Extract beginning of string (prefix)

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

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