toUpperCase

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2008
Posts: 2
Reputation: Mquin is an unknown quantity at this point 
Solved Threads: 0
Mquin Mquin is offline Offline
Newbie Poster

toUpperCase

 
0
  #1
Feb 15th, 2008
How do I change the ASCII value of the character? It seems to give me the values but I don't know how to change them. I am not sure how to do it right.
		public void toUpperCase(){
		//	if ((ch >='a')&&(ch <='z'))
		//		return(char)(ch-32); // Explicit
		//	return ch;
			
			for(int i = 0; i < theString.length; i++){
				System.out.println("i="+i);
				
				if (((int)theString[i] >=97)&&((int)theString[i] <=122))
				{ theString[i]= (int)theString[i]-32;
				}
				System.out.println("j="+(int)theString[i]);
				 // Explicit
			}
		}
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 2
Reputation: Mquin is an unknown quantity at this point 
Solved Threads: 0
Mquin Mquin is offline Offline
Newbie Poster

Re: toUpperCase

 
0
  #2
Feb 15th, 2008
Never mind fix
theString[i]= (char) (theString[i]-32);
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 10
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Re: toUpperCase

 
0
  #3
Feb 15th, 2008
Java has it's own function defined called toUpperCase(char ch).
http://java.sun.com/javase/6/docs/ap...oUpperCase(int)
Last edited by joshSCH; Feb 15th, 2008 at 10:08 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 893 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC