Get a character in a string at a specific position

string:get_character_by_position(STRING $string, INT $position) : STRING

string:get_character_by_position('hi',0)
#=> "h"

# returns '' (empty string) if there are no characters at the specified position
string:get_character_by_position('hi',10)
#=> ""

string:get_character_by_position('hi there',3)
#=> "t"

Copyright ©2013-2022 SunSed®. All rights reserved.