web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / remove last line break...
Power Automate
Answered

remove last line break from a string output

(1) ShareShare
ReportReport
Posted on by 45

I have a string builder which builds a string with next line (line break). Need help in removing the last line break from a string output.

 From below example, need to remove "\n" just after File Server Access:

 

"1. FNPF eMail/OWA\n2. LiveLink/Content Server\n3. Photo Enquiry\n4. Internet Access\n5. File Server Access\n"

MoshinK786_0-1716611633060.png

 

 

Categories:
I have the same question (0)
  • Verified answer
    SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @MoshinK786 ,

     

    Use the trim function to remove the additional white spaces or new lines.

    trim(outputs('Compose'))

    Here outputs('Compose') is the input action.

     

    If this helps , give this answer a thumbs up and marks this as a solution.

     

    Thanks,

    Sanmesh

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at

    Hi @MoshinK786 

    Try:

    if(
     equals(
     substring(YOUR_STRING,sub(length(YOUR_STRING),2),2),
     '\n'
     ),
     substring(YOUR_STRING,0,sub(length(YOUR_STRING),2)),
     YOUR_STRING
    )

     

    (Replace YOUR_STRING with your variable or compose output)

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard