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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,760)