//不同字体大小的文字拼接
func attributedStringWith(_ prefix:String, _ prefixSize:CGFloat,_ suffix:String, _ suffixSize:CGFloat)-> NSAttributedString{
let start = NSMutableAttributedString(string: prefix)
start.addAttribute(.font, value: UIFont.systemFont(ofSize: prefixSize), range: NSRange(location: 0, length: prefix.count))
let end = NSMutableAttributedString(string: suffix)
end.addAttribute(.font, value: UIFont.systemFont(ofSize: suffixSize), range: NSRange(location: 0, length: suffix.count))
start.append(end)
return start
}
//不同颜色的文字拼接
func attributedStringWith(_ prefix:String, _ prefixColor:UIColor,_ suffix:String, _ suffixColor:UIColor)-> NSAttributedString{
let start = NSMutableAttributedString(string: prefix)
start.addAttribute(.foregroundColor, value: prefixColor, range: NSRange(location: 0, length: prefix.count))
let end = NSMutableAttributedString(string: suffix)
end.addAttribute(.foregroundColor, value: suffixColor, range: NSRange(location: 0, length: suffix.count))
start.append(end)
return start
}