Given below are all the possible programs that will help you get a good grasp on String concept in java. (Update in Progress)
Note: Follow all the business rules where applicable.
Note: Follow all the business rules where applicable.
- Write a method that takes a String and calculates the total number of characters in the String. Business Rules :-Rule 1 : If any special characters is present in the string , print -1. Rule 2 : String should contain only alphanumeric values and white spaces.
- Write a method which takes a string as input and returns true if its a valid IP address and false if not a valid IP.Business Rules :- Rule 1 : IP address should be like 10.10.23.56Rule 2 : All the digit must be between 0 to 255 except for the first digit which is 1 to 255.Rule 3 : Total 4 numbers would be there separated by only dots.Rule 4 : All the fields must be either dot or digits(no white space or symbols or alphabets allowed).
- Write a method that accepts a string and returns the total number of vowels in that string.
- Write a method that takes a string array and returns the count of palindromes in the string array.
- Write a method that will accept a string and will return the string after removing all characters other than alphabets.
- Write a method which accepts a string(ex. This is a pen and is used to write) and returns a list<int> where the index of all occurrences of "is" is stored.
- Write a method that will take two strings and will return an integer which is the frequency of first string in second string .Input1:- isInput2:-He is a good boy,but his brother is not.Output:- 2
- Write a method that will take a string and will remove duplicate characters keeping only the first occurrence.Input:- Kolkataaaaa Output:- Kolat
- Write a method that will take a string and will return an int array that contains the length of the largest and smallest words.
- Write a method that will take a string which will be the password for a very secured account.Business Rules:-The string should be maximum 10 characters long,minimum 8 characters long, should have a minimum 1 special character, 1 uppercase character , 1 lowercase character and 1 digit. The string should not start with digit or special symbols. No space is allowed. If all conditions satisfy return true and otherwise false.
No comments:
Post a Comment