using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int p = 0;
Regex p1 = new Regex("^[\u4E00-\u9FA5{0,}]$");
for (int i = 0; i < textBox1.Text.Length; i++)
{
p = p1.IsMatch(textBox1.Text[i].ToString()) ? ++p : p;
}
textBox2.Text = p.ToString();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int p = 0;
Regex p1 = new Regex("^[\u4E00-\u9FA5{0,}]$");
for (int i = 0; i < textBox1.Text.Length; i++)
{
p = p1.IsMatch(textBox1.Text[i].ToString()) ? ++p : p;
}
textBox2.Text = p.ToString();
}
}
}