subject of the mail is “Externals appointments held - Kristan Tay”
strName = Strings.split(subject.toString,“-”)(1) — is what i am using to extract
but in some cases when subject is like "Externals appointments held "
It throws out of range , please could u provide a solution @ashwin.ashok@Palaniyappan could u please help
Option 1: Try Catch
You could use a try catch to catch this exception when you are using the result? With the exception type being: IndexOutOfRangeException
Option 2: Count results using If Statement (Combine with Regex or String Manipulation) Checkout this Regex Pattern
Then count the number of results. If results = 0
Condition: INSERT_REGEX_Variable.Count = 1
THEN: Continue.
Else: Do nothing.