Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
Does string contain only digits
//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) { String str = "1234657k9"; Boolean flag = DoesStringContainOnlyDigits(str); Console.WriteLine("Only digits " + flag); } public static Boolean DoesStringContainOnlyDigits(String st) { Boolean flag = true; foreach(char ch in st) { if(ch>='0' && ch <= '9') flag = true; else { flag = false; break; } } if(flag) return true; else return false; } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
CancellationToken Struct dot net
Square Real Matrix
e
1.3 Basics: interfaces
Using System.Reflection to find Property Name and Value of any Generic Class
DI
Reverse Number
ss
BreakNum2
Login Silencioso
Please log in to post a comment.