1.

Write a javascript program to capitalize the first letter of each word of a given string

Answer»

public STATIC VOID main(String arg[])
{
String str1=""
INT I, p
Char CHR,chr1
Str=' '+str
P=str.length()
For (i=0 ;i

{

Chr=str.charAt(0)
If(chr==' ')
{
Chr=str+charAt(i+1)
Str1=str+' '+Character. toUpperCase(chr1)
i=i+1
}
Else
Str1=Str1+chr
}
System. out. println(str1)
}
}
// program ends



Discussion

No Comment Found