0% found this document useful (0 votes)
26 views3 pages

String Q

The document outlines a series of static methods for string manipulation in Java, including counting words, spaces, characters, and vowels, as well as reversing strings and checking for palindromes. It also includes methods for trimming spaces, changing case, and finding anagrams. Additionally, there are methods for generating triangles of strings, counting frequencies, and handling binary to decimal conversions.

Uploaded by

vansh4242sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views3 pages

String Q

The document outlines a series of static methods for string manipulation in Java, including counting words, spaces, characters, and vowels, as well as reversing strings and checking for palindromes. It also includes methods for trimming spaces, changing case, and finding anagrams. Additionally, there are methods for generating triangles of strings, counting frequencies, and handling binary to decimal conversions.

Uploaded by

vansh4242sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

1) static int wordCount(String s)

2) static int spaceCount(String s)

3) static int charCount(String s) //without spaces

4) static String reverse(String g)//dont use reverse() function of StringBuffer

5) static boolean palindrome(String s)

6) static String ITrim(String s) //remove left spaces //dont use trim() function

7) static String rTrim(String s) //remove right spaces //dont use trim() function

8) static String allTrim(String s) //equivalent to trim() //dont use trim()


function

9) static String squeeze(String s) //remove all spaces and convert whole String in
one word

10)static int vowelCount(String s)

11)static int length(String s)//dont use length() function

12)static void sequenceCount(String s)

13)static void frequencyCount(String) //print frequency wise order

14)static String changeCase(string s) //InDla => iNdiA

15)static String singleOccurence(String s) //nniittiiin => nitin

16)static void sortedOrder(String s)//manish-->ahimns

17)static String sortedWord(String)//india aus china japan-->aus china india japan

18)static boolean find(String s1, String s2) //s2 in s1 dont use indexOf()and
lastIndexOf() function

19)static String replace(String s1, String s2, String s3) //if s2 is found in s1,
replace s2 with s3

20)static boolean equals(String s1, String s2)//dont use equals() function

21)static void triangle1 (String s1){


a
ap
app
apps
appsq
appsqu
appsqua
appsquad
appsquadz
}

22)static void triangle2 (String s1){


appsquadz
appsquad
appsqua
appsqu
appsq
apps
app
ap
a
}

23)static void triangle3 (String s1){


appsquadz
ppsquadz
psquadz
squadz
quadz
uadz
adz
dz
z
}

24)static void triangle2 (String s1){


appsquadzappsquadz
appsquad ppsquadz
appsqua psquadz
appsqu squadz
appsq quadz
apps uadz
app adz
ap dz
a z
}

25)static int compare(String s1, String s2)//dont use compareTo() function

26)public static void wordFrequencyCount(String s1) count the frequency of each


word in a string

27)solve the string


public int expression("10+20+20+20")

28)public int Binary ToDecimal("10101010")

29)public void printNonRepetingFirstChar(String s)

30)public void reverseEachWord(String s)//india usa china->aidni asu anihc

31)public void printAllWordsInReverseOrder(String s)//india usa china->china usa


india

32)boolean findDigitInString(String s)

33)int countDigitInString(String s)

34)Write down a program to find biggest substring in between specified character or


string
eg i am rajesh kumar ravi
in between 'a'
35)DOG >print all the combination of this word

36)find the largest palindrom in a String.//nitin madam malayalam

37)count the percentage of small letters, Capital letters and special characters in
String
"abcdeHIJLLM@@@::...."

38)Given two strings s1 and s2 consisting of lowercase characters, the task is to


check whether the two given
strings are anagrams of each other or not. An anagram of a string is another
string that contains the same
characters, only the order of characters can be different. For example, "act"
and "tac" are anagrams of each other.

Examples:
Input: str1 ="listen" str2 ="silent"
Output: "Anagram"
Explanation: All characters of "listen" and "silent" are the same.

Input: str1 = "gram" str2 = "arm"


Output: "Not Anagram"

You might also like