"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 thread ...

Replies:

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.