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 Apps / Remove all commas at t...
Power Apps
Unanswered

Remove all commas at the end of string.

(0) ShareShare
ReportReport
Posted on by 363

I know of TrimEnds but it appears to only work with blank spaces. Is there a way dynamically remove commas a the end of a string whether that be 1, 2, 3, 50 commas?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @colbyturybury ,

    For all commas

    Substitute(
     YourString, 
     ",", 
     ""
    )

    or for at the end

    If(
     Right(YourString,1) = ",",
     Left(
     YourString,
     Len(YourString) - 1
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • colbyturybury Profile Picture
    363 on at

    The number of characters would need to be dynamic. Sometime there could be 1 comma other times there could be 5 commas

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @colbyturybury ,

    You would need to hard-code to the maximum expected

    If(
     Right(
     YourString,
     5
     ) = ",,,,,",
     Left(
     YourString,
     Len(YourString) - 5
     ),
     Right(
     YourString,
     4
     ) = ",,,,",
     Left(
     YourString,
     Len(YourString) - 4
     ),
     Right(
     YourString,
     3
     ) = ",,,,",
     Left(
     YourString,
     Len(YourString) - 3
     ),
     Right(
     YourString,
     2
     ) = ",,",
     Left(
     YourString,
     Len(YourString) - 2
     ),
     Right(
     YourString,
     1
     ) = ",",
     Left(
     YourString,
     Len(YourString) - 1
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • colbyturybury Profile Picture
    363 on at

    Could this be simplified with a "With" statement?

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @colbyturybury ,

    With does nothing more than set a Temporary Variable - not relevant here. I actually tried a ForAll(Sequence()), but it was not suitable for the task.

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @colbyturybury ,

    OK - went another direction - this should work

    First(
     Filter(
     ForAll(
     Sequence(
     Len(YourString),
     0
     ),
     Left(
     YourString.Text,
     Len(YourString) - Value
     )
     ),
     !(EndsWith(
     Value,
     ","
     ))
     )
    ).Value

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • colbyturybury Profile Picture
    363 on at

    Just what I needed. I never would have figured this out. Thank you so much for your help!!!

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @colbyturybury ,

    Gald to help - if you have not already, take a moment to understand what is happening with the code - it will help you understand (in particular) what ForAll() does (which is not a loop like most people believe)

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard