@IMAX99
Can you check if the string you are trying to pass actually has some text value? or is it Null? As we are extracting the first character, if the value being passed is null, it will return that error.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!