cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mobilismexico
Helper I
Helper I

find spaces in string with indexOf

I need to find the position of the first space in a string so I can manipulate the content of the string. I'm trying to use the indexOf function, but I can't get it to work.

 

I've tried using a space between single apostrophes, and the char(32) function. None of these work.

 

When I try using a space between single apostrophes I get a -1 result.

 

indexof(' ',triggerBody()['text'])

 

When I try using char(32) the flow errors out with the message:

Unable to process template language expressions in action 'IndexOf_Space' inputs at line '1' and column '6357': 'The template function 'char' is not defined or not valid.'.

 

indexof(char(32),triggerBody()['text'])

 

 

mobilismexico_0-1633438663228.png

 

How does the indexOf function work when searching for spaces?

1 ACCEPTED SOLUTION

Accepted Solutions
mobilismexico
Helper I
Helper I

2 REPLIES 2
Paulie78
Super User
Super User

A space between single quotes should work. But if you want to try your "char(32)" method, then use this expression instead:

decodeUriComponent('%20')
mobilismexico
Helper I
Helper I

I just had it backwards. So dumb.

 

indexOf(OriginalText, ' ')

 

Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (2,231)