Ruby 字符串 codepoints 方法
codepoints 是Ruby中的一个字符串类方法,用于返回str中字符的整数序数的阵列。
语法: str.codepoints
参数: 这里,str是给定的字符串。
返回: str.codepoints是字符串类方法,用于返回str.codepoints中字符的整数位数组。
例子 1 :
输出
例2 :
输出
codepoints 是Ruby中的一个字符串类方法,用于返回str中字符的整数序数的阵列。
语法: str.codepoints
参数: 这里,str是给定的字符串。
返回: str.codepoints是字符串类方法,用于返回str.codepoints中字符的整数位数组。
例子 1 :
输出
例2 :
输出