更新时间:2023-11-28 16:50:58
if (TextBox1.Text.Split('.').Length > 1)
{ // alert message for multiple dots
}
if (TextBox1.Text.Trim() == ".")
{
// alert message for only dot
}
尝试:
Try:
if (myTextBox.Text.Trim() == ".")
{
...
}
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Regex r1 = new Regex(@"^.