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)
```
string t = "";
foreach (char c in Properties.Settings.Default.password)
{
      if (IsNumber(x)) t += System.Convert.ToInt32(c).ToString();
      else
      {
          t += c.ToString();
      }
}

```

Moreover, if you just want to get rid off '-' the use this code: `t =String.Replace(t, '-');`