IonicWind Software

IWBasic => General Questions => Topic started by: Andy on October 23, 2018, 09:12:46 am

Title: a little help
Post by: Andy on October 23, 2018, 09:12:46 am
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.
:)
Title: Re: a little help
Post by: LarryMc on October 23, 2018, 12:04:51 pm
Code Select
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
Title: Re: a little help
Post by: Andy on October 23, 2018, 01:06:44 pm
Thanks Larry,

That is what the string would like like,

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

Thanks,
Andy.
Title: Re: a little help
Post by: LarryMc on October 23, 2018, 06:08:24 pm
Did you scroll all the way to the bottom where I show the code to extract each line?
Title: Re: a little help
Post by: Andy on October 24, 2018, 01:25:02 am
Larry,

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

Thanks for the help!

Andy