package org.jeecg.common.util;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import java.util.ArrayList;
|
import java.util.Collections;
|
import java.util.List;
|
|
public class OrgCodeSplitUtil {
|
public static List<String> splitOrgCode(String orgCode) {
|
if(StringUtils.isBlank(orgCode)) {
|
return Collections.emptyList();
|
}
|
if(orgCode.length() % 3 != 0) {
|
return Collections.emptyList();
|
}
|
List<String> list = new ArrayList<>();
|
int length = orgCode.length();
|
for (int i = length; i > 0; i -= 3) {
|
list.add(orgCode.substring(0, i));
|
}
|
return list;
|
}
|
|
public static void main(String[] args) {
|
String orgCode = "A01A01A01";
|
List<String> list = splitOrgCode(orgCode);
|
System.out.println(list);
|
}
|
}
|