C#if else 规则
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Da...
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;
using System.Windows;
namespace lianxi2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
int lYSS = int.Parse(textBox1.Text);
int rYSS = int.Parse(textBox2.Text);
int dSu = 1;
string ySF = "";
if (jianFaYSF.Checked == true)
dSu = lYSS - rYSS;
else if (jiaFaYSF.Checked == true)
dSu = lYSS + rYSS;
textBox3.Text = dSu.ToString();
textBox4.Text = textBox1.Text+ySF +textBox2.Text +ySF +textBox3.Text ;
}
}
}
代码如上,我想判断在textBox4.Text显示的+或者-号这么写不成吗?〉可以添加天IF判断里就出错 展开
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows;
namespace lianxi2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
int lYSS = int.Parse(textBox1.Text);
int rYSS = int.Parse(textBox2.Text);
int dSu = 1;
string ySF = "";
if (jianFaYSF.Checked == true)
dSu = lYSS - rYSS;
else if (jiaFaYSF.Checked == true)
dSu = lYSS + rYSS;
textBox3.Text = dSu.ToString();
textBox4.Text = textBox1.Text+ySF +textBox2.Text +ySF +textBox3.Text ;
}
}
}
代码如上,我想判断在textBox4.Text显示的+或者-号这么写不成吗?〉可以添加天IF判断里就出错 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
推荐于2016-03-30
展开全部
public static boolean isNumeric(String str){
for (int i = str.length();--i>=0;){
if (!Character.isDigit(str.charAt(i))){
return false;
}
}
return true;
}
for (int i = str.length();--i>=0;){
if (!Character.isDigit(str.charAt(i))){
return false;
}
}
return true;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询