text = GetComponent<Text>().text;
char[] ch = text.ToCharArray();
print(text);
print(ch[0] + ch[1] + ch[2] + ch[3]);
结果是
怎么才能让它正确提取前四个字符2021?
同学你好,可以参考一下:
http://www.csref.cn/vs100/method/System-String-ToCharArray.html
https://blog.csdn.net/cumtv80668/article/details/107800263