I ran the code you provided with the input:
h.ello
and got the output hello
I am seeing a fully functional method here. I presume the punctuation you are trying to remove is not part of the ASCII range you provided in the if statement. Check your ASCII values against a chart.
ASCII values chart to compare with
Without including the proper values the input:
h[ello
will return the output h[ello
because the [
is ASCII value 91, which is outside the range you provided:
>= 32 && <= 46