-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStr.java
More file actions
43 lines (43 loc) · 712 Bytes
/
Copy pathStr.java
File metadata and controls
43 lines (43 loc) · 712 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
class Str
{
String n;
Str()
{
n="hello world this is nikhil";
}
String strReverse(String n)
{
String r="";
int count=n.length()-1;
String ar[]=n.split("");
for(String i:ar)
{
r=r.concat(ar[count]);
count--;
}
System.out.println(r);
return r;
}
String fupr(String n)
{
String r="";
String ar[]=n.split(" ");
int count=0;
for (String i:ar)
{
ar[count]=i.substring(0,1).toUpperCase()+i.substring(1).concat(" ");
r=r.concat(ar[count]);
count++;
}
n=r.trim();
return n;
}
public static void main(String s[])
{
String p;
Str o=new Str();
//p=o.fupr(o.n);
p=o.strReverse(o.n);
//System.out.println(p);
}
}