CSharp examples for System:String Number
Checks if the string has all the same letter/number
using System.Text.RegularExpressions; using System.Text; using System.Globalization; using System.Collections.Generic; using System;//from w ww. ja va2s. c o m public class Main{ //Checks if the string has all the same letter/number //aaaaaaaaaaaaaaaaaaa -> true //aaaaaaaaaaaaaaaaaab -> false public static bool IsRepeatedChar(string input) { if (input.Length == 0) return false; return input.Replace(input.Substring(0, 1), "").Length == 0; } }