/**
把换成你项目所需要的字符就行
/
fun encryptionName(name: String): String {
return if (name.length > 2) {
val toCharArray = name.toCharArray()
val nameBuffer: StringBuffer = StringBuffer()
for (index in toCharArray.indices) {
if (index == 0) {
nameBuffer.append(toCharArray[index])
continue
}
if (index == toCharArray.size - 1) {
nameBuffer.append(toCharArray[index])
continue
}
nameBuffer.append("")
}
nameBuffer.toString()
} else {
name
}
}
网友评论