I'm reworking a string math rounding and display limit routine, and I decided to take it easy on myself, for a change, so, I started with this...
c# = a# - b#
x$
= MID$(n$
, 1, b#
- 1) + MID$(n$
, b#
+ 1) n2$
= MID$(n2$
, 1, f#
) + "." + MID$(n2$
, f#
+ 1) n$ = n2$
That code uses a variable for just about every step. Normally, I just write long string arguments, which is the next example, without the need for doing the above. I have to admit, doing the above made it easier. By substitution, I mean I took what the variable was equal to, an substituted that part of the statement (cut and paste) wherever the variable letter occurred.
IF RIGHT$(n2$
, 1) = "." THEN n2$
= MID$(n2$
, 1, LEN(n2$
) - 1) ' Remove a trailing decimal point. n$ = n2$
Anyway, I'm pretty sure I haven't invented anything new in the way of coding, but I was curious if any of you guys have taken similar approach, or use other helpful methods to make complicated coding work a bit easier.
Pete