基本上我的问题是我在变量版本上使用 substring 方法来获取结果,然后使用 ng-href 在 URL 中使用:
substring(0, 3)
version 9.1.0 = 9.1 (good)
version 9.2.0 = 9.2 (good)
version 9.3.0 = 9.3 (good)
..
version 9.10.0 = 9.1 (breaks here)
version 10.1.0 = 10. (breaks here)
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,最终子字符串方法停止工作,我该如何解决这个问题?
我已经在C#中实现了一个计算器,除此之外一切正常,基本上,如果我尝试在小数点前输入数字,则会重置数字,然后才让我在小数点后输入数字,我认为这有点愚蠢。会很快解决,但我没有运气
这是我的代码:
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;
namespace GrantCalculator
{
public partial class Form1 : Form
{
int count = 0;
float result = 0;
string operation = "";
bool operationPressed = false;
public Form1()
{
InitializeComponent();
}
private void btnClear_Click(object sender, EventArgs e)
{
//clearing result
txtResult.Text = "0";
result = 0;
}
private void btn_Click(object sender, EventArgs e)
{
if (count == 0)
{
//remove …Run Code Online (Sandbox Code Playgroud)