Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 0UovZFeD58wvyyGjyyIPio
Power Automate - General Discussion
Unanswered

Find / Extract the first character of a string

Like (1) ShareShare
ReportReport
Posted on 3 Sep 2020 14:30:24 by 55

This seems like it should be simple but I just can't find a way to extract the first character of a string. There's no pattern to the strings so I cannot use split or substring. What a I need is something like Left([string],1) but I just can't see how to do this in Power Automate.

  • IMAX99 Profile Picture
    55 on 03 Sep 2020 at 16:33:34
    Re: Find / Extract the first character of a string

    PA snapshot 3-9-20a.pngPA snapshot 3-9-20b (2).pngDesign and run time with error message. This is using the expression '

    substring(split(item(),',')?[0],0,1)

    '

    The data is coming in from a CSV file, hence the split by comma. 

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on 03 Sep 2020 at 16:16:11
    Re: Find / Extract the first character of a string

    @IMAX99 

     

    Can you share a snippet of how you are passing this value to the function? 

     

    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • IMAX99 Profile Picture
    55 on 03 Sep 2020 at 16:07:49
    Re: Find / Extract the first character of a string

    The string is coming from an array. I'm using the split function to separate out the values. This working great so I know the values exist. One of these items contains a text value for a 'Company' name and what I'd like to do is extract the first character from this item.

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on 03 Sep 2020 at 15:57:42
    Re: Find / Extract the first character of a string

    @IMAX99 

     

    Can you check if the string you are trying to pass actually has some text value? or is it Null? As we are extracting the first character, if the value being passed is null, it will return that error. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • IMAX99 Profile Picture
    55 on 03 Sep 2020 at 15:49:46
    Re: Find / Extract the first character of a string

    Already tried that but get an error 'substring' parameter is out of range....

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on 03 Sep 2020 at 15:18:29
    Re: Find / Extract the first character of a string

    Hi @IMAX99 

     

    Can you try 

     

    substring('string',0,1)

     

    This will return 's' in this case. You can replace the 'string' by selecting a variable output or any text output from the dynamic selector. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - General Discussion

#1
ankit_singhal Profile Picture

ankit_singhal 7 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 4 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 2 Super User 2025 Season 1

Overall leaderboard
Loading started