Identify if a string is a number

前端 未结 25 3511
無奈伤痛
無奈伤痛 2020-11-22 00:13

If I have these strings:

  1. \"abc\" = false

  2. \"123\" = true

  3. \"ab2\"

25条回答
  •  我在风中等你
    2020-11-22 00:33

    All the Answers are Useful. But while searching for a solution where the Numeric value is 12 digits or more (in my case), then while debugging, I found the following solution useful :

    double tempInt = 0;
    bool result = double.TryParse("Your_12_Digit_Or_more_StringValue", out tempInt);
    

    Th result variable will give you true or false.

提交回复
热议问题