Write a function to check whether a given input is an integer or a string.
Definition of an integer :
Every element should be a valid digit, i.e '0-9'.
Definition of a string :
Any one element should be an invalid digit, i.e any symbol other than '0-9'.
Input : 127 Output : Integer Explanation : All digits are in the range '0-9'. Input : 199.7 Output : String Explanation : A dot is present. Input : 122B Output : String Explanation : A alphabet is present.
This article is contributed by Rohit Thapliyal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Return maximum occurring character in an input string
- Print all the duplicates in the input string
- Remove characters from the first string which are present in the second string
- Remove duplicates from a given string
- A Program to check if strings are rotations of each other or not
- Print reverse of a string using recursion
- Write a program to print all permutations of a given string
- Divide a string in N equal parts
- Given a string, find its first non-repeating character
- Write a program to reverse an array or string
- Check for balanced parentheses in an expression
- Reverse words in a given string
- Find the smallest window in a string containing all characters of another string
- Check whether two strings are anagram of each other
- Lexicographic rank of a string
- An in-place algorithm for String Transformation
- Program to validate an IP address
- Count words in a given string
- String matching where one string contains wildcard characters
- Remove "b" and "ac" from a given string