Open shovradas opened 3 years ago
Read the following tutorials on While Loop and solve the below problems.
Solve the following problems
Do not use any String library method except length(), charAt(). Also do not use the + operator. [x] Write a program to find how many characters are there in a given string. [x] Write a program that will print all the characters of a given string. [x] Write a program that will print all the characters of a given string in reverse order (by index). [x] Write a program that will print the ASCII values of all the characters in a given string. [x] Write a program that will determine if a given string starts with a given character. Print Yes or No. [x] Write a program that will determine if a given string ends with a given character. Print Yes or No. [x] Write a program that will determine if a given string starts with "he" or not. Print Yes or No. [x] Write a program that will determine if a given string ends with "he" or not. Print Yes or No. [x] Write a program that will search for a given character in a given string. If found print the position else print "NOT FOUND" [x] Write a program that will count the occurrences of a given character in a given string. [x] Write a program to find how many words are there in given sentence. [ ] Write a program to print all the words in a given sentence in separate lines. [x] Write a program to find how many sentences are there in a given paragraph. [ ] Write a program to print all the sentences in a given paragraph in separate lines. [x] Write a program that will print only the vowels in a string. [x] Write a program that will count the number of vowels in a string. [x] Write a program that will print only the consonants in a string. [x] Write a program that will count the number of consonants in a string. [x] Write a program that will search for a pattern "he" in a string. If found print the position else print "NOT FOUND" [x] Write a program to find how many "he" is there is in a string. [x] Write a program to print the substring of a given string. A substring is specified by a start and an end index. The end index is not inclusive. StringBuilder Do not use any String library method except length(), charAt(), setCharAt(). Also do not use the + operator. [x] Write a program to transform a given lowercase string to uppercase and print. [x] Write a program to transform a given uppercase string to lowercase and print. [x] Write a program that will replace a given character with an asterisk(*) in a given string and print. [ ] Write a program that will replace the first occurrence of a given character with an asterisk(*) in a given string and print. [ ] Write a program that will replace the last occurrence of a given character with an asterisk(*) in a given string and print. [x] Write a program to transform a given string to uppercase and print. [x] Write a program to transform a given string to lowercase and print. [x] Write a program that will toggle the case of all the characters in a given string and print. [ ] Write a program to copy one string A to another string B and after copying print B. [ ] Write a program to reverse a given string More [ ] Write a program to compare two strings A & B lexicographically. Print 0 if A==B. If A>B print 1 else print -1 [ ] Write a program to add two strings A & B into another string C. [ ] Write a program that can decide if a given string is palindromic or not. [ ] Write a program to compare two strings A & B lexicographically. Print 0 if A==B. If A>B print 1 else print -1. The comparison is case-insensitive. SUBMISSION Your submission should contain the following files Strings/String/YourFile1Name.java Strings/StringBuilder/YourFile1Name.java Strings/More/YourFile1Name.java ...
Do not use any String library method except length(), charAt(). Also do not use the + operator.
length()
charAt()
+
Do not use any String library method except length(), charAt(), setCharAt(). Also do not use the + operator.
setCharAt()
Your submission should contain the following files
TUTORIALS
Read the following tutorials on While Loop and solve the below problems.
PROBLEMS
Solve the following problems
String