Zelaron Gaming Forum  
Stats Arcade Portal Forum FAQ Community Calendar Today's Posts Search
Go Back   Zelaron Gaming Forum > The Zelaron Nexus > Science and Art > Tech Help

 
 
Thread Tools Display Modes

 
Reply
Posted 2010-02-28, 12:54 PM in reply to Slyvr's post starting "Thank you good sirs. I'm sure that'll..."
Thank youu. The .charAt worked but I still have a problem. I need to know how many characters are in each string now so I can test each string's characters if they are lowercase. This is what I have so far for that portion...but I get a String Index Out Of Bounds Exception:
Quote:
for (i=0; i<30; i++){
if (Character.isLetterOrDigit(LastName.charAt(i))){
LastChar_count++;
}
else{
break;
}
}
for (i=0; i<30; i++){
if (Character.isLetterOrDigit(FirstName.charAt(i))){
FirstChar_count++;
}
else{
break;
}
}
I just need to count the number of characters.
"Ban shampoo, demand real poo"
Old
Profile PM WWW Search
Slyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzSlyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Slyvr
 



 
Reply
Posted 2010-02-28, 07:56 PM in reply to Slyvr's post starting "Thank youu. The .charAt worked but I..."
Slyvr said: [Goto]
Thank youu. The .charAt worked but I still have a problem. I need to know how many characters are in each string now so I can test each string's characters if they are lowercase. This is what I have so far for that portion...but I get a String Index Out Of Bounds Exception:

You can use the String method length() to determine how many characters there are in a string object. For instance, you may want to use something like for(int i=0; i < LastName.length(); i++) to iterate through each character in the string LastName.

Last edited by Knight Sir Rick; 2010-02-28 at 08:10 PM.
Old
Profile PM WWW Search
Knight Sir Rick enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzKnight Sir Rick enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Knight Sir Rick
 



 
Reply
Posted 2010-03-02, 09:56 AM in reply to Knight Sir Rick's post starting "You can use the String method length()..."
Thanks, I realized I could use the .length like ten minutes after posting this Lol. I finished the program and it works nicely. Thanks for your help
"Ban shampoo, demand real poo"
Old
Profile PM WWW Search
Slyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHzSlyvr enjoys the static noises of ten television sets simultaneously tuned to 412.84 MHz
 
 
Slyvr
 



 
Reply
Posted 2010-03-01, 11:27 AM in reply to Slyvr's post starting "Thank youu. The .charAt worked but I..."
If you want to see if all the characters in a string are lowercase, for String str, then you can do the following

Code:
if(str.compareTo(str.toLowerCase())!=0)
{
     //  do this if the string is not lower case
}
else
{
     // do this if string is lower case
}
No loops necessary.
Old
Profile PM WWW Search
Demosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to be
 
Demosthenes
 



 

Bookmarks

« Previous Thread | Next Thread »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules [Forum Rules]
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Faq Demosthenes Tech Help 4 2004-10-25 04:43 PM
Jeeze Ppl Plz Post! I)ark_Phoenix General Gaming 6 2002-05-05 05:04 PM
plz help me araider Diablo I & II 11 2002-04-06 02:16 AM
Programming GameCube Tech Help 7 2002-03-12 12:23 PM


All times are GMT -6. The time now is 07:44 AM.
'Synthesis 2' vBulletin 3.x styles and 'x79' derivative
by WetWired the Unbound and Chruser
Copyright ©2002-2008 zelaron.com
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.