if string is alphabetically greater than other string in objective
Posted
by Jonathan
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan
Published on 2010-05-23T17:44:56Z
Indexed on
2010/05/23
17:50 UTC
Read the original article
Hit count: 234
I'm trying to use an if statement to work out which of 2 strings comes first alphabetically. Like with numbers and greater and less than:
if (1 < 2) {
just with strings:
if(@"ahello" < @"bhello") {
Or would I have to have a string containing all the letters and then check the index of the first char in each string and see which index is greater, and the index that is less than the other comes first in the alphabet and then if they are equal move on to the next char and repeat?
© Stack Overflow or respective owner