判断一个整数是否回文串
func isPalindrome(x int) bool {
if x < 0 {
return false
}
//把数转成字符串,按照字符串的判断法则
var s = strconv.Itoa(x)
lenth := len(s)
left := (lenth - 1) / 2
right := (lenth) / 2
for left >= 0 && right < lenth && s[left] == s[right] {
left--
right++
}
if right-left-1 == lenth {
return true
}
return false
}