+ Reply to Thread
Results 1 to 6 of 6

Compare Strings Question

  1. #1
    Sabo, Eric
    Guest

    Compare Strings Question

    I have the following:

    If current = temp then

    End if


    My problem is the following:

    Current = Apple
    temp = APPLE

    How can I compare these two strings without the case involved. I want the
    if statement to treat them as equal.

    Thank,
    Eric Sabo




  2. #2
    Norman Jones
    Guest

    Re: Compare Strings Question

    Hi Eric,

    Try:

    If LCase(current) = LCase(temp) then


    ---
    Regards,
    Norman



    "Sabo, Eric" <[email protected]> wrote in message
    news:[email protected]...
    >I have the following:
    >
    > If current = temp then
    >
    > End if
    >
    >
    > My problem is the following:
    >
    > Current = Apple
    > temp = APPLE
    >
    > How can I compare these two strings without the case involved. I want
    > the if statement to treat them as equal.
    >
    > Thank,
    > Eric Sabo
    >
    >




  3. #3
    Tim
    Guest

    Re: Compare Strings Question

    Hi Eric I think this should work

    If StrComp(temp, Current, vbTextCompare) = 0 Then

    'Your Code in here

    End If

    regards,

    Tim


  4. #4
    Tim
    Guest

    Re: Compare Strings Question

    Hi Eric I think this should work

    If StrComp(temp, Current, vbTextCompare) = 0 Then

    'Your Code in here

    End If

    regards,

    Tim


  5. #5
    Tom Ogilvy
    Guest

    Re: Compare Strings Question

    if strcomp(Current,Temp,1) = 0 then


    or

    if ucase(Current) = Ucase(Temp) then

    --
    Regards,
    Tom Ogilvy


    "Sabo, Eric" <[email protected]> wrote in message
    news:[email protected]...
    > I have the following:
    >
    > If current = temp then
    >
    > End if
    >
    >
    > My problem is the following:
    >
    > Current = Apple
    > temp = APPLE
    >
    > How can I compare these two strings without the case involved. I want

    the
    > if statement to treat them as equal.
    >
    > Thank,
    > Eric Sabo
    >
    >
    >




  6. #6
    Dave Peterson
    Guest

    Re: Compare Strings Question

    There's a setting that you can use that makes text comparisons case insensitive.

    Add
    Option Compare Text
    Right at the top of the module--outside any procedure.

    Then you can just compare:

    if current = temp then

    If case never matters for any procedure in that module, it's an easy fix.


    "Sabo, Eric" wrote:
    >
    > I have the following:
    >
    > If current = temp then
    >
    > End if
    >
    > My problem is the following:
    >
    > Current = Apple
    > temp = APPLE
    >
    > How can I compare these two strings without the case involved. I want the
    > if statement to treat them as equal.
    >
    > Thank,
    > Eric Sabo


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1