当前位置: 代码迷 >> 综合 >> Salesforce 将String拆分成Char并且替换字符
  详细解决方案

Salesforce 将String拆分成Char并且替换字符

热度:15   发布时间:2023-12-19 01:59:22.0

参考

https://salesforce.stackexchange.com/questions/14987/coverting-a-string-to-array-of-characters

// splitting on empty gives you an array of the string's "chars":
String source = 'foo bar';
String[] chars = source.split('');
// the 1st element in an Apex '' split is garbage; remove it:
chars.remove(0);
System.debug(chars);
// change a char:
chars[6] = 'z';
// prints "foo baz":
System.debug(String.join(chars, ''));
  相关解决方案