March 28, 2024, 06:42:32 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


a little help

Started by Andy, October 23, 2018, 09:12:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Just wanted to add something into the new constants search program and for the life of me I can't (but I should be able to) work it out.

I have an ISTRING with this as its contents...

First line of text + a chr$(13) + second line of text + a chr$(13) and so on.

How do I read the first line + chr$(13) and then move on to the second line without line 3 etc?

Thanks - this will be a really big help to me!

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

openconsole

istring zText[10000]

  zText = "This is a test of a long string of text wrapped into"+chr$(13)
        zText = zText + "a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText + "until there is no more text to wrap or until"+chr$(13)
        zText = zText + "the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText + "to print and the defining rectangle, you need"+chr$(13)
        zText = zText + "to tell the engine how much leading to use."+chr$(13)
        zText = zText + "The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText + "is the amount of space from the top of one line"+chr$(13)
        zText = zText + "of text to the top of the next line of text."+chr$(13)
        zText = zText + "Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText + "carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText + "If you look at the code,"+chr$(13)
        zText = zText + "you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText + "before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText + "and starts the text following it on the next line."+chr$(13)
        zText = zText + "It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText + "ascii 13 followed by ascii 10) the same as a single "+chr$(13)
        zText = zText + "carriage return."+chr$(13)
        zText = zText + "a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText + "until there is no more text to wrap or until"+chr$(13)
        zText = zText + "the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText + "to print and the defining rectangle, you need"+chr$(13)
        zText = zText + "to tell the engine how much leading to use."+chr$(13)
        zText = zText + "The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText + "is the amount of space from the top of one line"+chr$(13)
        zText = zText + "of text to the top of the next line of text."+chr$(13)
        zText = zText + "Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText + "carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText +  "If you look at the code,"+chr$(13)
        zText = zText + "you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText + "before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText + "and starts the text following it on the next line."+chr$(13)
        zText = zText + "It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText + "ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText + "carriage return."+chr$(13)
        zText = zText + "a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText + "until there is no more text to wrap or until"+chr$(13)
        zText = zText + "the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText + "to print and the defining rectangle, you need"+chr$(13)
        zText = zText + "to tell the engine how much leading to use."+chr$(13)
        zText = zText + "The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText + "is the amount of space from the top of one line"+chr$(13)
        zText = zText + "of text to the top of the next line of text."+chr$(13)
        zText = zText + "Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText + "carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText + "If you look at the code,"+chr$(13)
        zText = zText + "you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText + "before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText + "and starts the text following it on the next line."+chr$(13)
        zText = zText + "It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText + "ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText + "carriage return."+chr$(13)
        zText = zText + "a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText + "until there is no more text to wrap or until"+chr$(13)
        zText = zText + "the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText + "to print and the defining rectangle, you need"+chr$(13)
        zText = zText + "to tell the engine how much leading to use."+chr$(13)
        zText = zText + "The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText + "is the amount of space from the top of one line"+chr$(13)
        zText = zText + "of text to the top of the next line of text."+chr$(13)
        zText = zText + "Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText + "carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText +  "If you look at the code,"+chr$(13)
        zText = zText + "you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText + "before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText + "and starts the text following it on the next line."+chr$(13)
        zText = zText + "It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText + "ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText + "carriage return."+chr$(13)
        zText = zText + "a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText + "until there is no more text to wrap or until"+chr$(13)
        zText = zText + "the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText + "to print and the defining rectangle, you need"+chr$(13)
        zText = zText + "to tell the engine how much leading to use."+chr$(13)
        zText = zText + "The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText + "is the amount of space from the top of one line"+chr$(13)
        zText = zText + "of text to the top of the next line of text."+chr$(13)
        zText = zText + "Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText + "carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText + "If you look at the code,"+chr$(13)
        zText = zText + "you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText + "before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText + "and starts the text following it on the next line."+chr$(13)
        zText = zText + "It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText + "ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText + "carriage return."+chr$(13)
        zText = zText + "a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText + "until there is no more text to wrap or until"+chr$(13)
        zText = zText + "the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText + "to print and the defining rectangle, you need"+chr$(13)
        zText = zText + "to tell the engine how much leading to use."+chr$(13)
        zText = zText + "The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText +"is the amount of space from the top of one line"+chr$(13)
        zText = zText +"of text to the top of the next line of text."+chr$(13)
        zText = zText +"Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText +"carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText + "If you look at the code,"+chr$(13)
        zText = zText +"you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText +"before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText +"and starts the text following it on the next line."+chr$(13)
        zText = zText +"It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText +"ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText +"carriage return."+chr$(13)
        zText = zText +"a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText +"until there is no more text to wrap or until"+chr$(13)
        zText = zText +"the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText +"to print and the defining rectangle, you need"+chr$(13)
        zText = zText +"to tell the engine how much leading to use."+chr$(13)
        zText = zText +"The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText +"is the amount of space from the top of one line"+chr$(13)
        zText = zText +"of text to the top of the next line of text."+chr$(13)
        zText = zText +"Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText +"carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText +"If you look at the code,"+chr$(13)
        zText = zText +"you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText +"before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText +"and starts the text following it on the next line."+chr$(13)
        zText = zText +"It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText +"ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText +"carriage return."+chr$(13)
        zText = zText +"a rectangle. It will wrap text in the rectangle"+chr$(13)
        zText = zText +"until there is no more text to wrap or until"+chr$(13)
        zText = zText +"the rectangle has been filled. Besides the text"+chr$(13)
        zText = zText +"to print and the defining rectangle, you need"+chr$(13)
        zText = zText +"to tell the engine how much leading to use."+chr$(13)
        zText = zText +"The leading (as I have defined it anyway :)"+chr$(13)
        zText = zText +"is the amount of space from the top of one line"+chr$(13)
        zText = zText +"of text to the top of the next line of text."+chr$(13)
        zText = zText +"Breaking at paragraphs is very easy, just put"+chr$(13)
        zText = zText +"carriage returns (and optionally line feeds)"+chr$(13)
        zText = zText + "If you look at the code,"+chr$(13)
        zText = zText +"you will notice that I have inserted 2 carriage returns"+chr$(13)
        zText = zText +"before this sentence. ddoc respects the carriage return"+chr$(13)
        zText = zText +"and starts the text following it on the next line."+chr$(13)
        zText = zText +"It treats a carriage return followed by a line feed ("+chr$(13)
        zText = zText +"ascii 13 followed by ascii 10) the same as a single"+chr$(13)
        zText = zText +"carriage return."+chr$(13)
string LineText
int pos
pos = instr(zText,chr$(13))
?pos
while pos > 0
LineText= left$(zText,pos)
? LineText
zText= right$(zText,len(zText)-pos)
pos = instr(zText,chr$(13))
wend

waitcon
end
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Thanks Larry,

That is what the string would like like,

But how do I get each indivual line? beofre the next line?

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Did you scroll all the way to the bottom where I show the code to extract each line?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

No I didn't, my fault, and that sums up the Kind of day I had yesterday!

Thanks for the help!

Andy
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.