-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimpor_prog.java
More file actions
37 lines (32 loc) · 880 Bytes
/
impor_prog.java
File metadata and controls
37 lines (32 loc) · 880 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
import java.util.Arrays;
public class impor_prog {
public static void main(String[] args) {
String s="chennai is __unesco @ recognized site";
String dem="";
for(int i=0;i<s.length();i++)
{
char c=s.charAt(i);
if(Character.isAlphabetic(c))
{
dem=dem+c;
}
else if(c==' ')
{
dem=dem+" ";
}
}
String []s1=dem.split("\\s+");
System.out.println("Array="+Arrays.toString(s1));
String res="";
for(int i=0;i<s1.length;i++)
{
res=res+upper(s1[i]+" ");
}
System.out.println("result="+res);
//System.out.println(dem);
}
public static String upper(String str)
{
return str.substring(0,1).toUpperCase()+str.substring(1);
}
}