1, the beginning of the judgment:
String.startsWith ( " objective character ")
2, it is determined at the end:
string.endswith ( " objective character ")
return
True or False
Also, suggesting that first time, remove the string and trailing spaces, the method prior to determination:
string.strip()