Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4NtngCTviFgmibndDSfZm4
Power Automate - Building Flows
Answered

How i can get all the charecters after the first "-"

Like (0) ShareShare
ReportReport
Posted on 4 Oct 2021 14:26:17 by 3,502

I have values such as:-

 

Station-Quebec

Station-St-Marys

Stat-Test

 

so how i can get all the characters after the first "'-" ? so i should get :-

 

Quebec

St-Marys

Test

 

? thanks

 

 

  • Verified answer
    Paulie78 Profile Picture
    8,407 Super User 2025 Season 1 on 05 Oct 2021 at 08:59:57
    Re: How i can get all the charecters after the first "-"

    Like this:

    2021-10-05_09-58-25.png

    The two expressions in the select action are:

    split(outputs('Compose'), decodeUriComponent('%0A'))
    
    join(skip(split(item(), '-'), 1), '-')

    Blog: tachytelic.net

    YouTube: https://www.youtube.com/c/PaulieM/videos

    If I answered your question, please accept it as a solution 😘

  • Verified answer
    v-bofeng-msft Profile Picture
    on 05 Oct 2021 at 08:22:08
    Re: How i can get all the charecters after the first "-"

    Hi @johnjohn123 :

    I've made a test for your reference:

    vbofengmsft_0-1633422011298.png

    vbofengmsft_1-1633422022037.png

    Reference expression:

    1\split(outputs('Compose'),variables('Return'))
    2\skip(items('Apply_to_each'),add(indexOf(items('Apply_to_each'),'-'),1))

    The Result

    vbofengmsft_2-1633422090795.png

     

    Best Regards,

    Bof

     

  • Verified answer
    Expiscornovus Profile Picture
    31,643 Most Valuable Professional on 04 Oct 2021 at 14:44:42
    Re: How i can get all the charecters after the first "-"

    Hi @johnjohn123,

     

    One approach could be to use an indexOf to determine the position of the first - character. After that you can use the length of the whole string to calculate the part you want to collect with a substring.

     

    Below is an example of that approach:

    substring(outputs('Compose'), add(indexOf(outputs('Compose'), '-'), 1), sub(length(outputs('Compose')), add(indexOf(outputs('Compose'), '-'),1)))

     

    indexof_substring.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard
Loading started
Loading complete