cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Skip first and last n-characters

Hi,

 

i have an email body converted to text from html but the body contains 2 embeded images so the start and the end of the body is [cid:ismage001.jpg@01Da58sd5D1.A6FaaD87F0] or something like.

 

so the body is :

[cid:ismage001.jpg@01Da58sd5D1.A6FaaD87F0]

 

Email text bla bla

Email [text bla bla22]

Email text bla bla

Email [text bla bla33]

 

[cid:ismage001.jpg@01Da58sd5D1.A]

 

i want to keep only the text and remove from the beginning and from the end [cid:ismage001.jpg@01Da58sd5D1.A6FaaD87F0] and [cid:ismage001.jpg@01Da58sd5D1.A] because i want to build another email to send with my images.

 

So, what is the function to skip first n-chars and remove the the last?

I did alot of mess because there are many [ ] and not the only ones at the begenning and at the end

Maybe i have to array the brackets and remove the first and last? How to do that?

Sorry for bad English

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User III
Dual Super User III

Let's say that a variable call varText contains the following:

 

"[cid:ismage001.jpg@01Da58sd5D1.A6FaaD87F0] Email text bla bla Email [text bla bla22] Email text bla bla Email [text bla bla33] [cid:ismage001.jpg@01Da58sd5D1.A]"

 

then the following formulas will strip out the beginning and ending image designation.

substring(variables('varText'),Add(indexOf(variables('varText'),']'),1))
substring(outputs('Compose'),0,lastIndexOf(outputs('Compose'),'['))

put the first in a Compose action.  That strips off the front.  Then put the second in another Compose action.  That takes the result from the first Compose and strips off the last.

 

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
Dual Super User III
Dual Super User III

If you know how many characters you need to strip off each end then you can use Substring(text, startindex, length).

 

If you don't know, but know what needs to be stripped out then you can use a combination of Substring(), IndexOf, and LastindexOf to find the locations of the start or end of what needs to be stripped out and calcu.ate from there. 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Yeah, can you explain me better in my case how to apply this functions giving me an exemple?

Thnak you

Dual Super User III
Dual Super User III

Let's say that a variable call varText contains the following:

 

"[cid:ismage001.jpg@01Da58sd5D1.A6FaaD87F0] Email text bla bla Email [text bla bla22] Email text bla bla Email [text bla bla33] [cid:ismage001.jpg@01Da58sd5D1.A]"

 

then the following formulas will strip out the beginning and ending image designation.

substring(variables('varText'),Add(indexOf(variables('varText'),']'),1))
substring(outputs('Compose'),0,lastIndexOf(outputs('Compose'),'['))

put the first in a Compose action.  That strips off the front.  Then put the second in another Compose action.  That takes the result from the first Compose and strips off the last.

 

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (76,705)