0% found this document useful (0 votes)
2 views7 pages

String - Computer Programming

The document contains various Java programs that demonstrate string manipulation techniques. These include converting case, checking string equality, determining string case type, combining strings, reversing strings, counting lowercase and uppercase letters, and finding the character with the greatest ASCII value. Each program is presented with its respective code and comments.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

String - Computer Programming

The document contains various Java programs that demonstrate string manipulation techniques. These include converting case, checking string equality, determining string case type, combining strings, reversing strings, counting lowercase and uppercase letters, and finding the character with the greatest ASCII value. Each program is presented with its respective code and comments.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

//Q1.

WAP to convert the lowercase string to uppercase and


uppercase string to lowercase
/*
import [Link].*;
class string {
public static void main () {
String a,x;
Scanner sc=new Scanner([Link]);
a=[Link]();
x=[Link]();
[Link](x);
}
}
/*
import [Link].*;
class string {
public static void main() {
String a,b;
Scanner sc=new Scanner([Link]);
a=[Link]();
b=[Link]();
if ([Link](b)) {
[Link]("Equal");
}
else {
[Link]("Not Equal");
}
}
}*/

//WAP to check if a string is in uppercase , lowercase or mixed


/*
import [Link].*;
class string {
public static void main () {
String a,b,c,y;
Scanner sc=new Scanner([Link]);
a=[Link]();
b=[Link]();
c=[Link]();
if ([Link](b)) {
[Link]("It is in uppercase");
}
else if ([Link](c)) {
[Link]("It is in lowercase");
}
else {
[Link]("Mixed of both uppercase and
lowercase");
}

}
}
*/

//WAP to input two string and combine them


import [Link].*;
class string {
public static void main() {
Scanner sc=new Scanner([Link]);
String a;
String b;
String c;
a=[Link]();
b="Sarkar";
c=[Link](b);
[Link](c);
}
}

//WAP to input a string and return the reverse of a string.


/*
import [Link].*;
class string {
public static void main () {
Scanner sc=new Scanner([Link]);
String s=[Link]();
StringBuilder res = new StringBuilder();
[Link](s);
[Link]();
[Link](res);
}
}
*/
//WAP to find out how many small letters and how many
capital letters are there in a string.
/*
import [Link].*;
class string {
public static void main() {
Scanner sc = new Scanner([Link]);
String a,c;
int i=0,upcs=0,lowcs=0,b;
a=[Link]();
b=[Link]();
for (i=0;i<b;i=i+1) {
char ch=[Link](i);
if([Link](ch)) {
upcs=upcs+1;
}
else if([Link](ch)) {
lowcs=lowcs+1;
}
}
[Link]("The number of lower case characters
are:-"+lowcs);
[Link]("The number of upper case characters
are:-"+upcs);

}
}
*/
/*
//WAP to find the greatest string in a string statement.
import [Link].*;
public class AsciiInString {
public static void main() {
int asciitot=0;
char win='x';

Scanner sc = new Scanner ([Link]);


String strcap,str;
strcap=[Link]();
str=[Link]();
[Link]("The cgaracter with greatest ascii value
is:"" + str + "\":");

for (int i = 0; i < [Link](); i++) {


char character = [Link](i);
int asciiValue = (int) character;
for (int j = 0;j < [Link]() ; j++) {
char characterr = [Link](j);
int ascii = (int) characterr;
if (asciiValue>=ascii) {
win = characterr;
}
}
}
[Link](win);
}
}
*/

You might also like