Question: I have a string which comprise lots of letters. I have used the following code to convert it to numbers, but the new string **t** still gives me imperfect result.
For example:

> 
> tung2003 -> -1-1-1-12003
> 
> 
> **What I expected:** 1161171101032003 (116 is the ASCII code of **t**, 117 is the ASCII code of **u**
> 
> 
> 

```
string t=null;
foreach (char c in Properties.Settings.Default.password)
{
      int ascii = (int)Char.GetNumericValue(c);
      int counter=0;
      counter = ascii;
      t = t + Convert.ToString(counter);
}

```

The problem is the **-** character. I want my new string only comprises numbers.

Answer: 
It looks like you do *not* want the ASCII values of the numbers based on your expected output. In that case you can just do something like this:

```
string input = "tung2003";

string output = string.Empty;

foreach(char c in input)
{
    if(char.IsNumber(c))
    {
        output += c;
    }
    else
    {
        output += ((byte)c).ToString();
    }           
}
//output is now: 1161171101032003

```

Fiddle [here](https://dotnetfiddle.net/5lnr1w)
Also added as a Linq expression for a short hand solution. 

```
        // Method 1 Linq
        string output = string.Concat(("tung2003".ToCharArray()
            .Select(s=> char.IsDigit(s) ? s.ToString() : ((int)s).ToString())));

        // Method 2
        string input = "tung2003";
        string output = string.Empty;

        foreach (char c in input)
        {
            if (Char.IsDigit(c)) output += c.ToString();
            else output += ((int)c).ToString();
        }

```