text: public static String CreateSafeSheetName(String nameProposal, char replaceChar) {if (nameProposal == null) {return "null";}if (nameProposal.Length < 1) {return "empty";}int length = Math.Min(31, nameProposal.Length);String shortenname = nameProposal.Substring(0, length);StringBuilder result = new StringBuilder(shortenname);for (int i=0; i<length; i++) {char ch = result[(i)];switch (ch) {case '\u0000':case '\u0003':case ':':case '/':case '\\':case '?':case '*':case ']':case '[':result[i] = replaceChar;break;case '\'':if (i==0 || i==length-1) {result[i] = replaceChar;}break;default:break;}}return result.ToString();}