Jump to content

Grabbing an entire line of text from a paragraph


This topic is 2891 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi

I have a question about grabbing a particular line in a paragraph?

I would like to know how to grab or parse Line 7 in a text paragraph..

 

I pledge alligiance

to the flag

of the

United States of America

and to the

republic in which it stands

one Nation under God

indivisible with

Liberty and Justice

for All

 

 

I would like to get the line 7 "one nation under God" into my field "line 7"

I would like to get the line 4  "United States of America" into my field "line 4"

 

How can this be done?

Thanks

Link to comment
Share on other sites

>

 

Assume three fields:

Paragraph = eqauls the text to search

GrabRow = The row you want to retrieve

RowGrabText = a calculated result

 

You can use the formula: Middle (Paragraph ; Position ( Paragraph ; ¶ ; 1 ;GrapRow-1 )+1 ;  Position ( Paragraph ; ¶ ; 1 ;GrapRow ) - Position ( Paragraph ; ¶ ; 1 ;GrapRow-1 )-1 )

 

The formula uses the "Position" function to find paragraph returns (i.e. "¶").  when you enter "4" as the row to return it finds the position of the 3rd and 4th paragraph marker locations.  By taking the difference between the two you have the starting point and number of characters for the "Middle" function.  You will notice the "+1" and "-1" entries, these trim off the leading and trailing "¶'s" so that only the text is returned without a leading or trailing blank line.

 

 

*****************************************

 

No sure what you want to use it for, but this will return all text between the markers not just the line you may be seeing.  What I mean by that is that if you have a 5-sentence paragraph that word wraps in your box, it will pull all 5-sentences between the markers - not just the line you see in the text box.  It works for your example because each "line of text" ends in the paragraph marker.

 

 

>>>>


>

 

Well, that's embarrassing.  :idot:

 

>>>>

Link to comment
Share on other sites

This topic is 2891 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.