String indexOf() and lastIndexOf() Method
The String object indexOf() method gives you the ability to search for the first instance of a particular character value in a String. You can also look for the first instance of the character after a given offset. The lastIndexOf() method lets you do the same things from the end of a String.
In this case,
firstClosingBracket
equals 5, because the first
>
character is at position 5 in the String (counting the first character as 0). If you want to get the second closing bracket, you can use the fact that you know the position of the first one, and search from
firstClosingBracket + 1
as the offset, like so:
Source: String indexOf() and lastIndexOf() Method | Arduino Documentation | Arduino Documentation

