统计字符串中的数字个数
来源:互联网 发布:python 文件的移动 编辑:程序博客网 时间:2024/06/07 03:46
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 用户登录第一版
{
public partial class 计算相同数的个数 : Form
{
public 计算相同数的个数()
{
InitializeComponent();
}
int[] shu = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
private void button1_Click(object sender, EventArgs e)
{
string str = "";
string number = textBox1.Text;
string number1 = number;
for (int i = 0; i < number.Length; i++)
{
str += "," + number1.Substring(0, 1);
number1 = number1.Substring(1);
}
str += ",";
foreach (int item in shu)
{
switch (item)
{
case 0:
textBox2.Text += number + "中有" + (str.Split('0').Count() - 1).ToString() + "个0" + Environment.NewLine;
break;
case 1:
textBox2.Text += number + "中有" + (str.Split('1').Count() - 1).ToString() + "个1" + Environment.NewLine;
break;
case 2:
textBox2.Text += number + "中有" + (str.Split('2').Count() - 1).ToString() + "个2" + Environment.NewLine;
break;
case 3:
textBox2.Text += number + "中有" + (str.Split('3').Count() - 1).ToString() + "个3" + Environment.NewLine;
break;
case 4:
textBox2.Text += number + "中有" + (str.Split('4').Count() - 1).ToString() + "个4" + Environment.NewLine;
break;
case 5:
textBox2.Text += number + "中有" + (str.Split('5').Count() - 1).ToString() + "个5" + Environment.NewLine;
break;
case 6:
textBox2.Text += number + "中有" + (str.Split('6').Count() - 1).ToString() + "个6" + Environment.NewLine;
break;
case 7:
textBox2.Text += number + "中有" + (str.Split('7').Count() - 1).ToString() + "个7" + Environment.NewLine;
break;
case 8:
textBox2.Text += number + "中有" + (str.Split('8').Count() - 1).ToString() + "个8" + Environment.NewLine;
break;
case 9:
textBox2.Text += number + "中有" + (str.Split('9').Count() - 1).ToString() + "个9" + Environment.NewLine;
break;
default:
break;
}
}
}
}
}
- 统计字符串中的数字个数
- 统计字符串中的字母个数
- 统计字符串中的单词个数
- 统计字符串中的单词个数
- 统计字符串中的汉字个数
- 统计字符串中的字符个数
- 统计字符串出现数字的个数
- 字符串的统计の数字的个数
- 统计字符串中字母、数字、空格个数
- C# 统计字符串数字个数并输出
- ACM--数字个数--HDOJ 2017--字符串统计
- 统计一个字符串中数字的个数
- 输入一个字符串,编写函数统计该字符串中的字母、数字和其他字符的个数;
- C++统计字符串中的小字符串个数
- 统计字符串中的字母,数字,空格和其他字符的个数---指针
- 用C++统计字符串中的数字、字符和特殊字符的个数
- 统计字符串中的无重复字符个数
- 【2033】统计字符串中的字母个数
- Linux驱动修炼之道-framebuffer
- 浅析proc文件系统的创建和create_proc_read_entry函数的具体实现
- js指针移动小程序
- Winform窗体间的传值
- ImageView.ScaleType设置图解
- 统计字符串中的数字个数
- JMF应用篇 之 从摄像头捕获视频
- create_proc_read_entry(), create_proc_entry() | 创建 /proc 文件
- 简易的人员管理~数据的增、删、查、改
- 单例模式(java)
- Perl 学习笔记 --- 11
- js 实现一个图片浮动的效果
- js中的函数
- java instanceof