-
WAP to print any given inputString in following format.
Output index: 0 1 2 3 4 chars: H e l l o Every character is seprated by tab, use "\t" for inserting tab. -
WAP to print substring of a given inputString by using
String substring(int index). Accept inputString and index from user. -
WAP to accept inputString from user and replace all the vowels by *, by using
String replace(char oldChar, char newChar).String s1 = "vaibhav"; s1 = s1.replace('a','*'); System.out.println(s1); output: v*ibh*v -
Modify the above program so that: 1. first occurred vowel will be replaced by *. 2. Second occurred vowel will be replaced by ^. 3. Third occurred vowel will be replaced by !.
repeat the above process for all occurred vowels. -
WAP to replace all the occurrence of given subString from the inputString. --- (search library function for the task from the java docs by using the link [https://docs.oracle.com/en/java/javase/13/docs/api/java.base/java/lang/String.html]).
enter a string hello123 world123 how123 enter substring to be replaced by new string 123 enter new string 456 output: hello456 world456 how456 -
WAP to change case of given inputString to uppercase by using
String toUpperCase(). -
WAP to print the totalWeight of given inputString.
totalWeight can be calculate by adding *ASCII* value of all the characters. for example: inputString = "Abc"; totalWeight = 65 + 98 + 99; where ASCII values: A --> 65 b --> 98 c --> 99 -
WAP to print UpperWeight of given inputString. UpperWeight can be find by adding all the upper case characters of the inputString.
-
WAP to print AbsoluteWeight of given inputString. Absolute weigth can be calulated as:
absoluteWeight = UpperWeight - LowerWeight; 1. absoluteWeight will always be a positive value. 2. LowerWeight can be find by adding all the lower case characters of the inputString. -
WAP to print index of given character ch from inputString.
input: char ch = 'a'; String inputString = "vaibhav"; output: 1 -
WAP to print all the index in newline of given character ch form the inputString.
input: char ch = 'a'; String inputString = "vaibhav"; output: 1 5
-
Notifications
You must be signed in to change notification settings - Fork 0
Mukul-agrawal/StringPractice
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
This repository contains questions on String Handling.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published