tryparse

    1热度

    1回答

    这是我的问题。 我需要转换说“5.550”(字符串)加倍为5.550 是双重3位十进制数字。 我曾尝试IFormatProvider解析但没有use.it不断跳过最后零()。 请指教。 感谢, 库马尔M A

    1热度

    2回答

    下面是使用Int32.TryParse与if条件我的一段代码。(控制台应用程序) Console.WriteLine("Enter the no of the person(value for n)"); string number = Console.ReadLine(); Console.WriteLine("Enter the no of the bulb whose state

    2热度

    3回答

    我需要验证双精度值。当我TryParse .00 or ,00返回false,但我允许这个值必须为true。 此代码不是这种情况下正常工作 模型= 00或0.002,或789或0.12 ... double number; double.TryParse(model, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out number)

    9热度

    3回答

    我在Visual Basic.net中编写了一些代码,并且有一个问题。 如果我有一个很长的数字,那是大于1000,我怎样才能将这个值格式化为1,000(用逗号),并将其存储在一个字符串? 例如, 1234将被存储为1,234 12345将被存储为12345 123456将被存储为123456 这是用的TryParse语句来完成的? 我可以帮忙吗?

    -2热度

    2回答

    我的程序包含一个文本框。 我需要检查它是否只有数字,然后打印。 int num; if (this.Tree.GetType() == Main.TestInt.GetType()) { if (int.TryParse(this.label.Text,out num) == true) // i tried without the == before

    -1热度

    3回答

    情况 - 在我的web应用程序的线程培养已被设置为“ES”(西班牙语) Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("es"); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("es"); 字

    1热度

    2回答

    这里是我的代码: DateTime Dob = Convert.ToDateTime("1/1/1800"); DateTime Dod = Convert.ToDateTime("1/1/1800"); if (!DateTime.TryParse(p.birthday, out Dob) && !DateTime.TryParse(p.deathday, ou

    6热度

    6回答

    在我的应用程序中,我有一个文本框 - txtDiscount,管理员可以为某个用户设置折扣百分比,或者他可能不会。在后端我要保存的数据,所以现在我有这样的: double? discount = null; if (!string.IsNullOrEmpty(txtDiscount.Text)) { if (!double.TryParse(txtDiscount.Text, out

    -2热度

    2回答

    我有一组方法接收用户输入为字符串,并将其解析为每个方法的标题处的小数,整数等。所以,我有相同的代码重复多次在每一个方法,例如: public ..... CreateOrder(....., string rawSourceAmount) { decimal? sourceAmount2 = rawSourceAmount. TryToDecimal(XUtils.Deci