HP Forums
Text wrap mode - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Text wrap mode (/thread-17166.html)



Text wrap mode - DuckEgg - 06-25-2021 09:51 AM

Hello

Does hp have some kind of text wrap mode so that output such as 654765675865784866587657655555465 is displayed as:
6547656758
6578486658
7657655555
465
Instead of a list that goes off screen?

Use case: I need to find the divisors using idivis() of a four digit number and then examine that list to determine the factors that sum to a particular value.


RE: Text wrap mode - matalog - 06-27-2021 11:13 PM

You could display a number split into a set amount of numbers per line, as a string that was suitably formatted, using MSGBOX(), that would suffice to view what you have asked for.

If you want to use the numbers, you could set the list to be displayed around the screen, by programming the location of output text.

If you need to use the numbers you are displaying, you might be better to have them as a menu, where you can select them, after the list is converted into a menu, and a string, using DRAWMENU(), multiple times if necessary.


RE: Text wrap mode - DuckEgg - 06-28-2021 01:57 AM

Thanks, I found the answer was to manipulate lists (see photos)


RE: Text wrap mode - Albert Chan - 06-28-2021 11:40 AM

Unlike Python, CAS string is 1-based:

CAS> wrap(s,n) := transpose(makelist(k->s[k:k+n],1,len(s)+1,n))
CAS> s := "654765675865784866587657655555465"
CAS> wrap(s, 10)

\(\left(\begin{array}{c}
\mathrm{6547656758} \\
\mathrm{6578486658} \\
\mathrm{7657655555} \\
\mathrm{465}
\end{array}\right) \)


RE: Text wrap mode - roadrunner - 06-28-2021 06:40 PM

CAS> unwrap:=(sw)->(Σ(sw[n],n,1,length(sw)))[1]

CAS> unwrap(wrap(s,10))

"654765675865784866587657655555465"

-road


RE: Text wrap mode - Stevetuc - 06-29-2021 12:51 PM

(06-28-2021 11:40 AM)Albert Chan Wrote:  Unlike Python, CAS string is 1-based:

CAS> wrap(s,n) := transpose(makelist(k->s[k:k+n],1,len(s)+1,n))
CAS> s := "654765675865784866587657655555465"
CAS> wrap(s, 10)

\(\left(\begin{array}{c}
\mathrm{6547656758} \\
\mathrm{6578486658} \\
\mathrm{7657655555} \\
\mathrm{465}
\end{array}\right) \)
That works in XCas but gives syntax error on prime, with cursor at s[k:k+n ☆ ]


RE: Text wrap mode - roadrunner - 06-29-2021 05:36 PM

It works on my calculator. Make sure you are using makelist() and not MAKELIST()

-road