Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between System.copy and StrUtils.MidStr

Tags:

delphi

Delphi has functions System.copy and StrUtils.MidStr that both return a substring from within a string. Is there a difference between these two functions?

If so, what is the difference? And when should I use each one?

like image 308
awmross Avatar asked Nov 16 '12 05:11

awmross


1 Answers

Indeed, there is no difference: MidStr() uses Copy(). For strings that is, because Copy() can also be used for arrays, for which MidStr() is not suited.

(Personally, I think that some of the routines published by StrUtils unit are made for those who were comfortable with VB.)

like image 74
NGLN Avatar answered Nov 15 '22 03:11

NGLN