let string = "abide" if ( string.hasSuffix = ("e") ){ //最后位为e //xxx } if ( string.hasPrefix = ("a")){//第一位为a //xxx }