× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Thu, Feb 23, 2017 at 11:41 AM, Buck Calabro <kc2hiz@xxxxxxxxx> wrote:
On 2/22/2017 10:26 AM, Englander, Douglas wrote:
Does anyone have an edit code or edit word they can share that will add a floating plus sign for a positive number?

I can't say I've ever seen this request before. Out of idle curiosity, why?

That's almost always a good question to ask early on. The harder or
trickier the problem, the better it is to ask that question.

Finally I turned to MI, and
edit_packed(). That can handle floating signs.

I applaud the persistence. Sounds like your curiosity led you pretty
far down the rabbit hole, and now the community has another nifty, if
specialized, snippet. :)

Of course, the best RPG way is probably something like

if number >= 0;
edited = %editc(number: 'j'); // whatever
else;
number_positive = number * -1;
edited = '+' + %trim(%editc(number_positive: 'j')); // whatever
endif;

The edit codes with floating left minus are N through Q. (J is fixed
right minus.) And you've got some crossed wires regarding positive and
negative. But yeah, this overall approach seems more appropriate for
RPG.

I think I would do something more like

if number < 0;
edited = %editc(number: 'n');
else;
edited = '+' + %trim(%editc(number: 'n'));
endif;

Tweak as necessary if zero should have no sign.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.