943,884 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1157
  • Java RSS
Feb 15th, 2008
0

toUpperCase

Expand Post »
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
			}
		}
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mquin is offline Offline
2 posts
since Feb 2008
Feb 15th, 2008
0

Re: toUpperCase

Never mind fix
theString[i]= (char) (theString[i]-32);
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mquin is offline Offline
2 posts
since Feb 2008
Feb 15th, 2008
0

Re: toUpperCase

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.
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: setting path
Next Thread in Java Forum Timeline: Need advice





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC