3

I am Comparing a list of two strings in visualforce page using "Contains" function.But currently it retrieves only the exact match.Say,If the Name is Burlington it compares the name which contains "Burlington" but not "burlington".Is there some other way to check the same?

Page:

 <apex:outputPanel rendered="{!contains(wrap1.acc.Name,wrap2.acc2)}">
  • 5
    Convert All values to upper or lowercase – Eric Sep 12 '16 at 13:08
  • 1
    @Eric Why didn't you just post that as an answer? – Adrian Larson Sep 12 '16 at 13:20
  • 2
    @AdrianLarson was on mobile at the time – Eric Sep 12 '16 at 13:23
8
<apex:outputPanel rendered="{!contains(UPPER(wrap1.acc.Name),UPPER(wrap2.acc2))}">

Convert all to upper / lower case

  • By the way, @Pri, this is a trick you'll use for the rest of your life in data work (capitalizing or lowercasing both sides of the value comparison) -- so much so that you'll stop even thinking of it as a trick and just think of it as, "how you do a case-insensitive comparison!" Doesn't even really matter what the tool is. – k.. Sep 12 '16 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.