检查号码是否相同 [英] for checking number wether is same ornot
本文介绍了检查号码是否相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查天气,我们的字符串是否包含相同的数字
how to check weather our string contain same number or not
推荐答案
将数字转换为字符串并检查
Convert the number to string and check
using System;
public class IsNumberSample {
public static void Main() {
string str = "non-numeric";
Console.WriteLine(Char.IsNumber('8')); // Output: "True"
Console.WriteLine(Char.IsNumber(str, 3)); // Output: "False"
}
}
尝试一下:
try this:
using System.Text.RegularExpressions;
....
string comparestring = "888555";
string ourstring ="whatever string characters or numbers! like aaabbb or 888555"
string newstring = Regex.Match(ourstring, @"[\d]*").Value;
if(comparestring == newstring )
{
textbox1.text = newstring;
}
//your result = 888555
这篇关于检查号码是否相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文