Computer Science Canada String Help! |
Author: | speX [ Sun Oct 16, 2005 3:57 pm ] | ||||
Post subject: | String Help! | ||||
i have this program....
and the problem i keep having is
|
Author: | wtd [ Sun Oct 16, 2005 3:59 pm ] | ||
Post subject: | Re: String Help! | ||
speX wrote: and the problem i keep having is
strCheck is a String variable. charAt returns a character. |
Author: | speX [ Sun Oct 16, 2005 4:10 pm ] |
Post subject: | |
ok.. so how would i make it select the first character.. of user input |
Author: | rizzix [ Sun Oct 16, 2005 5:02 pm ] |
Post subject: | |
char strCheck = strInput.charAt(i); strCheck == 'A'; // true if strCheck contains 'A' |
Author: | Andy [ Sun Oct 16, 2005 8:20 pm ] |
Post subject: | |
in java, strings start at 0, which means if you input a single character, the string will not have a character at location 1, simply change the 1 to 0 and it should be fine |