Java 倒序 输出 截取emoji 表情

String str="\uD83D\uDE01\uD83D\uDE01\uD83D\uDE01";//uD83DuDE01 是一个表情

it length=str.codePointCount(0,str.length());

for(it i=length; i>=0;i--){

int start =str.offsetByCodePoints(0,0);

int end =str.offsetByCodePoints(0,i);

System.out.println("substr"+str.substring(start,end);

你可能感兴趣的:(Java 倒序 输出 截取emoji 表情)