{"record":{"id":"46dbab51a009b32c","repo":"egametang/ET","slug":"text-2-index-0-chr-1","errorCode":null,"errorMessage":"text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符","messagePattern":"text=(.+?), index=(.+?), chr='(.+?)', 此处只能出现小写英文字符","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs","lineNumber":177,"sourceCode":"                        {\n                            throwErrId = 0;\n                            sb.Append(lastChar).Append(c);\n                        }\n\n                        state = ReadChunkState.ReadText;\n                        break;\n                }\n\n                //处理错误\n                if (throwError && throwErrId > -1)\n                {\n                    switch (throwErrId)\n                    {\n                        case 0:\n                            throw new Exception(string.Format(\"text={3}, index={0}, chr='{1}'：此处只能出现'{2}'\", i, c,\n                                                              lastChar, value));\n                        case 1:\n                            throw new Exception(string.Format(\"text={2}, index={0}, chr='{1}', 此处只能出现小写英文字符\", i, c,\n                                                              value));\n                        case 2:\n                            throw new Exception(string.Format(\"text={2}, index={0}, chr='{1}', 此处只能出现小写英文或1-9的数字\", i, c,\n                                                              value));\n                        case 3:\n                            throw new Exception(string.Format(\"text={2}, index={0}, chr='{1}', 0-9的数字或'}}'\", i, c,\n                                                              value));\n                    }\n                }\n\n                lastChar = c;\n            }\n\n            //结尾处理\n            if (state != ReadChunkState.ReadText)\n            {\n                if (throwError)\n                {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.packagemanager/Editor/Tools/StrUtil_StrChunk.cs#L159-L195","documentation":"StrUtil.GetStrChunk error case 1: after an opening '{' (ReadyReadKey state), the next character must be a lowercase letter a-z to begin a key name. Any other character triggers this error. Only thrown when throwError=true.","triggerScenarios":"A placeholder like '{1key}' (starts with a digit), '{Key}' (uppercase), or '{_key}' (underscore) immediately after the '{'.","commonSituations":"Template/localization strings using uppercase or digits at the start of a placeholder key; placeholders copied from a different template syntax (e.g. {0}, {Name}) into this parser which expects {%key%num} form.","solutions":["Rename keys to start with a lowercase letter a-z, e.g. '{name1}' instead of '{Name1}' or '{1name}'.","Re-run with throwError=false for tolerant parsing during debugging.","Document the accepted grammar: '{' + lowercase-letters + non-zero-leading-digits + '}'."],"exampleFix":"// before\nvar chunks = StrUtil.GetStrChunk(\"{Name1}\", throwError: true);\n\n// after\nvar chunks = StrUtil.GetStrChunk(\"{name1}\", throwError: true);","handlingStrategy":"validation","validationCode":"StrUtil.GetStrChunk(template, throwError: false);","typeGuard":null,"tryCatchPattern":"try { chunks = StrUtil.GetStrChunk(tpl, throwError: true); }\ncatch (Exception) { chunks = StrUtil.GetStrChunk(tpl, throwError: false); }","preventionTips":["Start placeholder keys with lowercase a-z only.","Document the grammar: {key+digits}, key is lowercase letters.","Validate templates during authoring."],"tags":["packagemanager","editor","parsing","string-template"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}