Author Topic: mid confusion  (Read 1058 times)

0 Members and 1 Guest are viewing this topic.

jcfuller

  • Guest
mid confusion
« on: August 07, 2019, 01:54:23 AM »
Charles,
  I notice you put padstr and numstr in StringUtil.
Would you please explain the mid(s,-dp ) in this line???
Code: [Select]
s=ng+left(s,ls-dp)+"."+mid(s,-dp)

Thank you.

James

Charles Pegge

  • Guest
Re: mid confusion
« Reply #1 on: August 07, 2019, 04:40:03 AM »
Hi James,

A inegative index in mid counts from the right, instead of the left:

Code: [Select]
string s="abcdef"
print mid(s,-2) 'ef

jcfuller

  • Guest
Re: mid confusion
« Reply #2 on: August 07, 2019, 05:24:40 AM »
Charles,
  Isn't that the same as right(s,dp) ??
James

Charles Pegge

  • Guest
Re: mid confusion
« Reply #3 on: August 07, 2019, 06:38:14 AM »
Yes, the o2 right is a macro based on mid.