Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check If String Contains All "?"

Tags:

c#

How can I check if a string contains all question marks? Like this:

string input = "????????";

like image 416
Robert Avatar asked Nov 04 '10 00:11

Robert


People also ask

How do you check if a string contains all alphabets?

Read the String. Convert all the characters in the given String to lower case using the toLower() method. Convert it into a character array using the toCharArray() method of the String class. Find whether every character in the array is in between a and z, if not, return false.

How do you check if a string contains all the characters of another string?

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accepts a String and returns the starting position of the string if it exists, otherwise, it will return -1.

How do I check if a string contains?

The includes() method returns true if a string contains a specified string. Otherwise it returns false . The includes() method is case sensitive.

How do you check if a string is all digits?

Use the test() method to check if a string contains only digits, e.g. /^[0-9]+$/. test(str) . The test method will return true if the string contains only digits and false otherwise. Copied!


1 Answers

var isAllQuestionMarks = input.All(c => c == '?');
like image 139
Justin Niessner Avatar answered Oct 17 '22 06:10

Justin Niessner