You need to sign in to do that
Don't have an account?
Newbie_edm
How to Check sub string in the string?
Hi guys,
I need you guys help here, I have string which contains [A], I need to call class only if that main string has that [A] format it should not call class if it finds just A in that main string. How can we achieve this in Apex code?
Thanks.
I need you guys help here, I have string which contains [A], I need to call class only if that main string has that [A] format it should not call class if it finds just A in that main string. How can we achieve this in Apex code?
Thanks.
You can use indexOf(substring) method of string. Like :
String str = 'abc[A]';
if(str.indexOf('[A]')!=-1)
{
//execute code
}
You can find more documentation here:
https://developer.salesforce.com/forums/ForumsMain?state=id#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=906F0000000BZtjIAG
All Answers
You can use indexOf(substring) method of string. Like :
String str = 'abc[A]';
if(str.indexOf('[A]')!=-1)
{
//execute code
}
You can find more documentation here:
https://developer.salesforce.com/forums/ForumsMain?state=id#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=906F0000000BZtjIAG