How can I remove a sequence of characters from the end of a string in PowerShell

While strings have their own functions to trim characters they may not behave as expected. For example TrimEnd removes a sequence of characters from the end of a string however the emphasis is characters, i.e. it will remove any instance of those characters from the end of the string and not the string you specify. For example:

I should have ended with folke but instead fol. The reason is it keeps removing each character in the string “joke” until it comes to a letter not in the string. Folke ends with ke so those characters are removed as well! Instead I like to use substring starting from the beginning of the string and then trimming when it finds the first occurrence of what I want to remove.

For more you can check
Small Business Social Media Marketing

Was there a question? There’s nothing native to do this; you’ll have to write your own string processing routine to accomplish this.

Based on the link he posted, I think this is just a spam posting. Can’t really even figure out what the post is purportedly asking.