dcsimg
Results 1 to 4 of 4

Thread: [resolved]case-insensitive string compare

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    Resolved [resolved]case-insensitive string compare

    Quickie - just looking for an existing function to compare example and eXamLe which will return true, without having to overload string.compare functions.
    Last edited by pickarooney; Jun 13th, 2005 at 07:08 AM.

  2. #2
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,335

    Re: case-insensitive string compare

    Take your pick between UCase and/or LCase.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,726

    Re: case-insensitive string compare

    use vbTextCompare (= 1), i think that will be what you want

    Dim MyStr1, MyStr2, MyComp
    MyStr1 = "ABCD": MyStr2 = "abcd" ' Define variables.
    MyComp = StrComp(MyStr1, MyStr2, 1) ' Returns 0.
    MyComp = StrComp(MyStr1, MyStr2, 0) ' Returns -1.
    MyComp = StrComp(MyStr2, MyStr1) ' Returns 1.

    pete

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2005
    Posts
    103

    Re: case-insensitive string compare

    Many thanks.

    pete - I should get round to testing that other piece of code this afternoon, will let you know how it goes.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width