+ Start a Discussion
RAM RRAM R 

how can i check name with case insensitive ?

please suggest me if any one knows how can i achieve this requirement.

I want to check name case insensitive.
find below my code.
Public void UpdateStageNameSample(List<Opportunity> oppList){       
        List<Opportunity> optyList = new List<Opportunity>();
        String s = 'valued client';       
        for(Opportunity opp: oppList){
            if(opp.Name.contains(s.toUpperCase())){                
                opp.StageName = 'Sample';                           
            }
        }       
    }
Best Answer chosen by RAM R
SRKSRK
Like this

Public void UpdateStageNameSample(List<Opportunity> oppList)
{       
        List<Opportunity> optyList = new List<Opportunity>();
        for(Opportunity opp: oppList)
        {
            if(opp.Name.containsIgnoreCase('valued client'))
            {                
                opp.StageName = 'Sample';                           
            }
        }       
 }

All Answers

SRKSRK
You can user 

containsIgnoreCase(substring)
String s = 'hello';
Boolean b = s.containsIgnoreCase('HE');
System.assertEquals( true, b);
 
RAM RRAM R
How can i use in my requirement?
 
SRKSRK
Like this

Public void UpdateStageNameSample(List<Opportunity> oppList)
{       
        List<Opportunity> optyList = new List<Opportunity>();
        for(Opportunity opp: oppList)
        {
            if(opp.Name.containsIgnoreCase('valued client'))
            {                
                opp.StageName = 'Sample';                           
            }
        }       
 }
This was selected as the best answer
RAM RRAM R
Thank you so much SRK