I've been receiving this error and need some help resolving it.

for(LP_TFL__c tfl : termForLoanList0)

    for(ScorecardTier scorecardTier : scorecardTierList0)

      //Compare Tiers String on Term Object to Scorecard Tier Name and Match 
      //Credit Line Values Accordingly 

            ScorecardTier.creditLine = tfl.Credit_Line_Max_Amt__c;
            ScorecardTier.promoDays = tfl.Promotional_Period__c;
            ScorecardTier.apr = tfl.Interest_Rate__c;


Save error: Method does not exist or incorrect signature: void includes(String) from the type String

The loop is supposed to compare all tiers in termForLoans and add the matching attributes to scorecardTier object when it finds a match in the list.

1 Answer 1


The right function to use here is contains().

From the documentation:


Returns true if and only if the String that called the method contains the specified sequence of characters in substring.


public Boolean contains(String substring)

Parameters substring

Type: String

Return Value Type: Boolean


String myString1 = 'abcde';
String myString2 = 'abcd';
Boolean result = myString1.contains(myString2);

System.assertEquals(result, true);

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.