使用拆分后保存字符串[Gone WRONG]

Pin*_*ing 0 c# asp.net

char[] delimiterChars = {'-'};
string text = "123-45-6789"
string[] words = text.Split(delimiterChars);
foreach (string s in words)
{
  pdfFormFields.SetField("PutItHere: ", s);
}//foreach


Result: 
PutItHere: 6789
Run Code Online (Sandbox Code Playgroud)

我希望它像"123456789",我不知道如何操纵并把它这样.请帮忙.

Moh*_*ava 5

我想你应该已经使用Replace替代

string text = "123-45-6789";
text = text.Replace("-", String.Empty);
Run Code Online (Sandbox Code Playgroud)