- UID
- 1023
- UCC
-
- 声望
-
- 好评
-
- 贡献
-
- 最后登录
- 1970-1-1
|
- static string DivideByTwo(string input)
- {
- StringBuilder sb = new StringBuilder();
- int i;
- for (i = 0; i < input.Length; i++)
- {
- if (Char.IsNumber(input[i]))
- {
- sb.Append(input[i]);
- }
- if (input[i] == ',')
- {
- sb.Append('!');
- }
- }
- string reb = sb.ToString(); string[] tap = new string[3]; int j = 0;
- for (i = 0; i < reb.Length; i++)
- {
- if (Char.IsNumber(reb[i]))
- {
- tap[j] += reb[i];
- }
- else
- {
- j++;
- }
- }
- int[] numbers = new int[3];
- for (i = 0; i < 3; i++)
- {
- Int32.TryParse(tap[i], out numbers[i]);
- numbers[i] /= 2;
- }
- i = 0;
- StringBuilder sb2 = new StringBuilder();
- while (!Char.IsNumber(input[i]))
- {
- sb2.Append(input[i]);
- i++;
- }
- sb2.Append(numbers[0].ToString() + " ," + numbers[1].ToString() + " ," + numbers[2].ToString());
- return sb2.ToString();
- }
复制代码 注意: 不确定能用!!!
群里没看见... |
|