一、字符串增加偏移量转换
/**
* 给定一个字符串,包含大小写字母、标点符号、空格;另外给定一个偏移量,字母将变为偏移量之后的字母。
* 如偏移量为2,则a变为c,则z变为b;如果偏移后的字母是元音字母aeiouAEIOU,则将该字符转换为对应的大小写(小写变大写,大写变小写)
*/
public static String transCharacter(int offset, String orginalStr) {
// 字符偏移量:比如字母c char c = 'a' + (c-'a'+offset)%26
char[] charArray = orginalStr.toCharArray();
StringBuilder sb = new StringBuilder();
for (char c : charArray) {
if (Character.isLetter(c)) {
if (Character.isUpperCase(c)) {
c = (char) ('A' + (c - 'A' + offset) % 26)