-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamel-Casting.java
More file actions
46 lines (35 loc) · 967 Bytes
/
Camel-Casting.java
File metadata and controls
46 lines (35 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package placements;
//In Camel Casting we have to print all the Upper-Case Characters in a new line being converted into Lower-Case and print all the Lower-Case Characters in same line converted into Upper Case.
import java.util.*;
public class Camel {
static void camel(String a)
{
System.out.println("In Normal Format:- \n"+a);
char [] ch = a.toCharArray();
System.out.println("In Camel Casted Format:-");
for(char ele:ch)
{
if(Character.isUpperCase(ele))
System.out.print("\n"+Character.toLowerCase(ele));
else
System.out.print(Character.toUpperCase(ele));
}
}
public static void main(String [] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the String");
String a = sc.next();// in input for camel casting the string must not have space.
camel(a);
}
}
/*
Output:
Enter the String
HiHello
In Normal Format:-
HiHello
In Camel Casted Format:-
hI
hELLO
*/