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

split by first space

Hallo, 

I have a String which looks like this: 16 Streetname 23

The number at the beginning can be random. So it can be 3, 5, 8, 22.....

So I just want to extract the part: Streetname 23

 

thanks for any kind of help

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @MaxF ,

you could split it by the space, then skip the first object, and join the rest again using spaces.

join(skip(split(<string>, ' '),1), ' ')

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

4 REPLIES 4
tom_riha
Super User
Super User

Hello @MaxF ,

you could split it by the space, then skip the first object, and join the rest again using spaces.

join(skip(split(<string>, ' '),1), ' ')

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
miguelcas
Microsoft
Microsoft

Hi @MaxF 

Here is a way using expressions to get the string that you are looking for: 

substring(variables('StringToSplit'),add(indexOf(variables('StringToSplit'),' '),1), sub(length(variables('StringToSplit')),add(indexOf(variables('StringToSplit'),' '),1)))

I would recommend you to put this expressions into a compose action in order to get the string. This function will eliminate all characters before the first blank space from a string. in the function you need to replace the variables('StringToSplit') with your string as a variable, text or dynamic content. 

 

If you want to learn more about expressions and functions here are some MS Docs to consider. 

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

Microsoft Flow - Expressions and how to use them - Power Platform Community

 

Thank you for using Microsoft Power Platform Communities.
Community Support Team - Miguel Castro.
If this Post helps, then please consider Accept as solution to help the other members find it more quickly.

 

 

 

 

MaxF
Frequent Visitor

Hallo Tom,

 

thanks, your solution works for me because of that i accept your answer. 

The problem what have now, there was probably a display error in sharepoint where I want to store it,

Because when I look in details the string looks like this: 16Streetname 3
Because now it always returns me only the 3, which is correct according to your solution.
Do you have a solution for this(16Streetname 3) scenario too?
I still want only the string: Streetname 3
The numbers can still be random. 1,2,10, 22...

Hello @MaxF ,

since Power Automate doesn't support regular expression, I don't think it's doable. You could go character by character and check if it's a number, but that would be a terrible solution. Therefore, I don't have a solution for situations when there's no space.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,857)