Jump to content

remove text from paragraph up to the first "."


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

Recommended Posts

I have a situation where I have an entire line of text in a list but there are different numbers in front of the line of text

 ex.  ( I have 4 lines of text below representing a line of text in a field called (dialog)

 

 

443. this is the first time

06. when did you call?

11. Is that still possible

1098. Do you still think this is true?

 

Need to change to into the same field

 

his is the first time

when did you call?

Is that still possible

Do you still think this is true?

 

How can I do this? It is always a varying number followed by a period in the beginning of the line of text.

Link to comment
Share on other sites

It's difficult to understand if you have one field containing 4 lines of text, or 4 records with 1 line each, or...?

 

If it's the former, you will need a recursive calculation to remove the number from each line in turn. If you don't have the Advanced version (thus cannot install a custom function), you will need to script this.

 

It seems to me you'd be well advised to take this opportunity and split the lines off to separate records in a related table - where each record would have separate fields for the number and for the text.

Link to comment
Share on other sites

I am sorry for the confusion

In my example I meant  4 different records with one line each

I wanted to know how to remove everything before the first "." in the line.

 

And While I am at it and into studying the text parsing

How do I remove everything in a line After a certain Character or word ( which might contain varying length of words or characters)

 

so in the ONE line in the field "Dialog"  how do I remove in the same field ( I would guess in a set field calc) the text before a "." and leave the rest and  Like this

 

EX   In the field called 'dialog'

443. this is the first time   would become   this is the first time

 

Conversely, while I am trying to understand how to do this,

How could I remove all text after the "." for the rest of the line

Like this

 

ex. in the field called 'Dialog'

443. this is the first time   would become  443.

 

I thought I would ask using the same example so I could experiment with this and better understand this concept

Thanks

Link to comment
Share on other sites

Given a field named Dialog containing "443. this is the first time" :

Let ( [
pos = Position ( Dialog ; "." ; 1 ; 1 )
] ;
Left ( Dialog ; pos )
)

returns "443." and:

Let ( [
pos = Position ( Dialog ; "." ; 1 ; 1 )
] ;
Right ( Dialog ; Length ( Dialog ) - pos )
)

returns " this is the first time".

 

 

If you are sure that the first period is followed by exactly one space, you can use:

...
Right ( Dialog ; Length ( Dialog ) - pos - 1 )
...

to remove it, otherwise use:

...
Trim ( Right ( Dialog ; Length ( Dialog ) - pos ) )
...
Link to comment
Share on other sites

This topic is 2952 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.