Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inserting formatted text into a string
#1
Hi,
I have many small text files that I am inserting into a separate app document through means of a picklist dialog.
Each small text has simple formatting i.e. Paragraphs, single or double spaces between e.g.
Quote:This is the first sentence of a one sentence paragraph.

This is the first sentence of the second paragraph. This is the second and notice how there is no paragraph return or spaced between the sentences.

This is the third paragraph's first sentence. etc

I hope that gives the flavor. Obviously, the texts have more paragraphs than that and there are many > 100.

I have formatted a few as follows:

Code:
Copy      Help
str text = "This is the first sentence of a one sentence paragraph.[][]This is the first sentence of the second paragraph. This is the second and notice how there is no paragraph return or spaced between the sentences.[][]This is the third paragraph's first sentence. etc"

But this will take too long to do for each text. Is it possible to add simply formatted text into a string without doing the conversion above. I could have the dialog call up independent text files but I want to keep things all in QM macros rather than having to keep local files or network files available.

Thanks,

Stuart
#2
Paste in QM, select, right click the selection bar, assign to a variable.

Code:
Copy      Help
str s=
;This is the first sentence of a one sentence paragraph.
;
;This is the first sentence of the second paragraph. This is the second and notice how there is no paragraph return or spaced between the sentences.
;
;This is the third paragraph's first sentence. etc

out s

If there are lines that begin with tabs, make sure that spaces are before tabs. When you right click, QM inserts spaces after tabs, and this terminates the string.
#3
And when my macros have all the text in them, it will save 10 x that amount of work.
Thanks again!!!!!!

Stuart


Forum Jump:


Users browsing this thread: 1 Guest(s)