public static void validateSheetName(String sheetName) {if (sheetName == null) {throw new IllegalArgumentException("sheetName must not be null");}int len = sheetName.length();if (len < 1 || len > 31) {throw new IllegalArgumentException("sheetName '" + sheetName+ "' is invalid - character count MUST be greater than or equal to 1 and less than or equal to 31");}for (int i=0; i<len; i++) {char ch = sheetName.charAt(i);switch (ch) {case '/':case '\\':case '?':case '*':case ']':case '[':case ':':break;default:continue;}throw new IllegalArgumentException("Invalid char (" + ch+ ") found at index (" + i + ") in sheet name '" + sheetName + "'");}if (sheetName.charAt(0) == '\'' || sheetName.charAt(len-1) == '\'') {throw new IllegalArgumentException("Invalid sheet name '" + sheetName+ "'. Sheet names must not begin or end with (').");}}
public static void ValidateSheetName(String sheetName) {if (sheetName == null) {throw new ArgumentException("sheetName must not be null");}int len = sheetName.Length;if (len < 1 || len > 31) {throw new ArgumentException("sheetName '" + sheetName+ "' is invalid - character count MUST be greater than or equal to 1 and less than or equal to 31");}for (int i=0; i<len; i++) {char ch = sheetName[i];switch (ch) {case '/':case '\\':case '?':case '*':case ']':case '[':case ':':break;default:continue;}throw new ArgumentException("Invalid char (" + ch+ ") found at index (" + i + ") in sheet name '" + sheetName + "'");}if (sheetName[0] == '\'' || sheetName[len-1] == '\'') {throw new ArgumentException("Invalid sheet name '" + sheetName+ "'. Sheet names must not begin or end with (').");}}