public static String normalizeUserCode(String userCode) {
        Assert.hasText(userCode, "userCode cannot be empty");
        StringBuilder sb = new StringBuilder(userCode.toUpperCase().replaceAll("[^A-Z\\d]+", ""));
        Assert.isTrue(sb.length() == 8, "userCode must be exactly 8 alpha/numeric characters");
        sb.insert(4, '-');
        return sb.toString();
    }
@author: zlt
@date: 2023/11/14
<p>
Blog: https://zlt2000.gitee.io
Github: https://github.com/zlt2000
zlt-uaa/src/main/java/com/central/oauth/utils/OAuthEndpointUtils.java