Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Testing for Integers and Floats in a String
//Title of this code //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { // testing for integers in a string string myString = "230"; double myInt; bool isNumeric = double.TryParse(myString, out myInt); Console.WriteLine(isNumeric); Console.WriteLine(myInt+"\n"); // trying with a zero-padded string myString = "00425"; isNumeric = double.TryParse(myString, out myInt); Console.WriteLine(isNumeric); Console.WriteLine(myInt+"\n"); myString = "0000535.2431"; float myFloat; isNumeric = float.TryParse(myString, out myFloat); Console.WriteLine(isNumeric); Console.WriteLine(myFloat+"\n"); } } }
run
|
edit
|
history
|
help
0
jkb
DotnetQ7
Reverse String in for loop
a6
EMV_RESULTAT
static
(1:14) ; expected
nested try catch
database exterior 0.1
Random Integers