I am going to use a label in Apex code and compare it with another String variable. Example: Comparison

Label.MyLabel == MY_VARIABLE;

Do I need to first convert the label to String before comparing? If yes, how to do it?

  • No your label will return String only.
    – Ratan Paul
    Feb 16, 2016 at 10:47
  • I haven't tried to compile yet. Was just thinking of a solution approach and had this question. Thanks for replying!
    – ajinkyah
    Feb 16, 2016 at 12:36

1 Answer 1


Don't need to convert Label into String. All Labels are in String and compare with other String variable.

Have you get any error while doing this?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .