Home > Software engineering >  How to solve the statistics text edit box
How to solve the statistics text edit box

Time:10-01

Is "analysis" button, after statistics in the edit box the text edit box 1 and 2 output: this text have Chinese x, x in English and digital x,

CodePudding user response:

String s="abcd45612, asd";
Int characters=0;
Int Numbers=0;
Int symbols=0;
The foreach (char c in s)
{
If ((c & gt;=33 & amp; & C & lt;=47) | | (c & gt;=58 & amp; & C & lt;=64) | | (c & gt;=91 & amp; & C & lt;=96) | | (c & gt;=123 & amp; & C & lt;=126))
Symbols++;
If ((c & gt;=65 & amp; & C & lt;=90) | | (c & gt;=97 & amp; & C & lt;=122))
Characters++;
If (c & gt;=48 & amp; & C & lt;=57)
Numbers++;
}
  • Related