×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Thanks Barbara, that is the way it is beginning to sound like to me.

-----Original Message-----
From: Barbara Morris [mailto:bmorris@ca.ibm.com]
Sent: Thursday, May 23, 2002 12:13 PM
To: rpg400-l@midrange.com
Subject: Re: Text wrapping question


"Wills, Mike N. (TC)" wrote:
>
> But that won't work in this case, will it?
>
> >>>Let's say this is my string:
> This is a sentence that is longer than what will fit in my field.
>
> >>>Currently my report looks like this (%subst(string:1:37)):
> This is a sentence that is longer tha
> n what will fit in my field.
>
> >>>I want it to look like this (%subst(string:1:last space but less than
> 37)):
> This is a sentence that is longer
> than what will fit in my field.
>

You need a reverse scan.  There's no opcode or builtin for this, so
you'll have to code a loop.

    Something like this:

    len = 37
    for  i = 37 down to 1
    |   if  text(currentLine + i) is ' '
    |   |    len = i - 1
    |   |    exit the loop

If len is still 37, there's no blank and you have to break the string.

Barbara Morris


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2026 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.