CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2000
    Posts
    123

    string comparison

    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.


  2. #2
    Join Date
    Jan 2000
    Location
    Canada
    Posts
    249

    Re: string comparison

    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

  3. #3
    Join Date
    Mar 2000
    Posts
    123

    Re: string comparison

    THANK YOU :-)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured