
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Remove Leading Zeros from a String in C#
Let’s say the following is our string with leading zeros.
String str ="000234";
Use the TrimStart() method and set the 0 to remove it.
TrimStart(new Char[] { '0' } )
The following is the complete code to remove leading zeros.
Example
using System; class Program { static void Main() { String str ="000234".TrimStart(new Char[] { '0' } ); Console.WriteLine(str); } }
Output
234
- Related Questions & Answers
- Remove Leading Zeros From String in Java
- Remove Leading Zeros from an Array using C++
- Remove leading zeros in a JavaScript array?
- How to remove leading zeros from a number in JavaScript?
- Remove leading zeros in array - JavaScript
- Remove Trailing Zeros from string in C++
- Java Program to Remove leading zeros
- Remove leading zeros in array in JavaScript
- Python program to remove leading zeros from an IP address
- Add leading Zeros to Python string
- Removing leading zeros from a String using apache commons library in Java
- Add leading Zeros to Python Program string
- Explain how to remove Leading Zeroes from a String in Java
- Remove Leading Zeroes from a String in Java using regular expressions
- Trim (Remove leading and trailing spaces) a string in C#
Advertisements