Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how get integer only and remove all string in C# [duplicate]

Tags:

string

c#

integer

How can I remove the strings and get only integers?

I have a string ( 01 - ABCDEFG )

i need to get (01) only

like image 413
ghie Avatar asked Jun 15 '11 17:06

ghie


People also ask

How do I remove a string from a char array?

How can I delete all data from string (char array) in C lang? The typical way to do this is to set every character of the string to zero. The easiest way to do this is to use memset, assuming you know how much much valid memory the string has.

Which function converts string into integer in C?

In C, the atoi() function converts a string to an integer.


1 Answers

input = Regex.Replace(input, "[^0-9]+", string.Empty);
like image 199
Bala R Avatar answered Oct 08 '22 05:10

Bala R