Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Puffin Rock Characters Plush Toy Set
anil1961
Updated:
Saturday at 3:51 PM
Toyota Vitz scp10 For Sale
Lakmal Bandara
Updated:
Wednesday at 10:50 AM
Kandy
Welcome all my all new pet shop Bark.lk
dilumrane
Updated:
Nov 2, 2026
Windows RDP Only Rs.500 a month
Blogerwiki
Updated:
Nov 1, 2026
Ad icon
V2ray VPN for Tunneling
hu KANNA
Updated:
Oct 22, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Jobs & Employment
Programming interview - written tests
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Anonymous_Abstract" data-source="post: 24659395" data-attributes="member: 568286"><p><span style="font-size: 18px"> Method Create for Proper Case</span></p><p></p><p><span style="font-size: 15px"><span style="color: Blue">package com.benz.test;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"></span></span></p><p><span style="font-size: 15px"><span style="color: Blue">public class Reverse {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"></span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> public static void main(String[] args)</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> Reverse rev=new Reverse();</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> String nstr = rev.toProper("hEllo WORld beNz hOW are yoU");</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> System.out.println(nstr);</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> }</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> public void reverse(int value)</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> int rem;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> while(value>0)</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> rem = value % 10;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> System.out.print(rem);</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> value = value/10;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> }</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> }</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> </span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> public String toProper(String str)//hEllo WORld</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> if(str.trim().length()>0)</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> String newstr=null;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> str =str.toLowerCase();//hello world</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> String[] st = str.split(" ");//hello , world</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> char[] ch=null;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> for(String s : st)</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> {</span></span></p><p><span style="font-size: 15px"><span style="color: Blue">ch = s.toCharArray(); //'h' 'e' 'l' 'l' 'o' , 'w' 'o' 'r' 'l' 'd'</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> ch[0] = Character.toUpperCase(ch[0]);//'H' ,'W'</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> if(newstr==null)</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> newstr = new String(ch);</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> else</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> newstr +=" "+ new String(ch);</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> }</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> return newstr;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> </span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> }else</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> return str;</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"> }</span></span></p><p><span style="font-size: 15px"><span style="color: Blue">}</span></span></p><p><span style="font-size: 15px"><span style="color: Blue"></span></span></p></blockquote><p></p>
[QUOTE="Anonymous_Abstract, post: 24659395, member: 568286"] [SIZE="5"] Method Create for Proper Case[/SIZE] [SIZE="4"][COLOR="Blue"]package com.benz.test; public class Reverse { public static void main(String[] args) { Reverse rev=new Reverse(); String nstr = rev.toProper("hEllo WORld beNz hOW are yoU"); System.out.println(nstr); } public void reverse(int value) { int rem; while(value>0) { rem = value % 10; System.out.print(rem); value = value/10; } } public String toProper(String str)//hEllo WORld { if(str.trim().length()>0) { String newstr=null; str =str.toLowerCase();//hello world String[] st = str.split(" ");//hello , world char[] ch=null; for(String s : st) { ch = s.toCharArray(); //'h' 'e' 'l' 'l' 'o' , 'w' 'o' 'r' 'l' 'd' ch[0] = Character.toUpperCase(ch[0]);//'H' ,'W' if(newstr==null) newstr = new String(ch); else newstr +=" "+ new String(ch); } return newstr; }else return str; } } [/COLOR][/SIZE] [/QUOTE]
Insert quotes…
Verification
Dahaya deken beduwama keeyada?
Post reply
Top
Bottom