you can use
text="my unfinishing text with an unknown last character" result=text[-1].chr p result => r