Text Parser
#3
(10-03-2022, 12:49 AM)mnrvovrfc Wrote: Thank you for this. However, "Action" is not necessary and in fact produces confusion. To actually get lines must set it to zero, so why even need this parameter? For more serious work (eg. include into a simple word processor) check for hyphenated words as well as spaces to split lines.

Oh sure, the action parameter was added for my library needs. Strip the action code out if all you need is a simple parser with the ability to report one line at time during subsequent calls.

The library I'm writing has the need for number of lines to be reported. Pretty handy.

Here's an example use:

t$ = "big long crazy text string here. blah blah blah blah ... and blah"
FOR x=1 TO VAL(ParseText$(t$, 40, 1))
    Array(x).text = ParseText$(t$, 40, 0)
NEXT x

Or in my library's case I need to know the number of lines the text will be placed in to size ASCII text box windows appropriately.

Box(Index).height = VAL(ParseText$(t$, 40, 1)) + 4 ' top border + header text + header line delimiter + border bottom + lines of text
'Then, as the box is drawn lines of parsed text can be brought in one at time as needed

"as well as spaces to split lines"

It does do that.
Reply


Messages In This Thread
Text Parser - by TerryRitchie - 10-03-2022, 12:28 AM
RE: Text Parser - by mnrvovrfc - 10-03-2022, 12:49 AM
RE: Text Parser - by TerryRitchie - 10-03-2022, 01:07 AM
RE: Text Parser - by RhoSigma - 10-03-2022, 07:55 AM
RE: Text Parser - by Pete - 10-03-2022, 11:01 AM
RE: Text Parser - by James D Jarvis - 10-03-2022, 11:35 AM
RE: Text Parser - by RhoSigma - 10-03-2022, 11:51 AM
RE: Text Parser - by TerryRitchie - 10-03-2022, 01:18 PM
RE: Text Parser - by mnrvovrfc - 10-03-2022, 02:47 PM
RE: Text Parser - by TerryRitchie - 10-03-2022, 03:03 PM



Users browsing this thread: 2 Guest(s)