Click to See Complete Forum and Search --> : string comparison


daileyps
September 18th, 2000, 10:10 AM
How do I compare strings to determine sequence? IE. if I have String a = "ABC"; and String b = "DEF"; I want to compare a to b and get a result which tells me which should come first.

weaver
September 18th, 2000, 12:19 PM
use the following:

String a = "ABC", b = "DEF";

if (a.compare(b) < 0)
// a comes before b
else
// b comes before a




-------------------------------------------
weaver
icq# 64665116
Please rate this post.
http://weaver.x7.htmlplanet.com

daileyps
September 18th, 2000, 02:46 PM
THANK YOU :-)