-4

結果の文字列とは異なる単一の文字列値が必要です。

私の文字列変数の戻り値は次のようになります:

string result = "1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1";    //  from here I'll need  2

or string result = "1,1,1,1,1,1,1,1,4,1,1,1,1,1,1,1";    //  from here I'll need  4

or string result = "1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1";     //  from here I'll need  3
4

5 に答える 5

1

coma(,) と 1 を blank('') に置き換えるだけです。

string single_value = result.Replace(",","").Replace("1","");
于 2013-06-14T07:03:17.650 に答える