class RocketMqGroupNameNormalizier {

    public static String normalize(String groupName) {
        char[] originalChars = groupName.toCharArray();
        char[] newChars = new char[originalChars.length];

        for (int i = 0; i < originalChars.length; i++) {
            char originalChar = originalChars[i];

            // 如果不是合法的组名字符，那么用'-'替代
            char newChar = isLegalChar(originalChar) ? originalChar : '-';
            newChars[i] = newChar;
        }

        return new String(newChars);
    }

    private  RocketMqGroupNameNormalizier();

}