5
votes

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?

1

1 Answers

10
votes

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.)