- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
TrimEnd() method in C#
The TrimEnd() method removes all trailing occurrences of a set of characters specified in an array.
For example, the following string has trailing 1s.
String str ="234561111".
We can easily remove the above trailing 1s from a string using the TrimEnd() method.
Let us see an example to remove all trailing 1s.
Example
using System; class Program { static void Main() { String str ="234561111".TrimEnd(new Char[] { '1' } ); Console.WriteLine(str); } }
Output
23456
Advertisements