| 7 | using namespace CoreLib; |
| 8 | |
| 9 | CoreLib::String EscapeCodeName(CoreLib::String str) |
| 10 | { |
| 11 | StringBuilder sb; |
| 12 | bool isUnderScore = false; |
| 13 | for (auto ch : str) |
| 14 | { |
| 15 | if (ch == '_' || !((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))) |
| 16 | { |
| 17 | if (isUnderScore) |
| 18 | sb << "I_"; |
| 19 | else |
| 20 | sb << "_"; |
| 21 | isUnderScore = true; |
| 22 | } |
| 23 | else |
| 24 | { |
| 25 | isUnderScore = false; |
| 26 | sb << ch; |
| 27 | } |
| 28 | } |
| 29 | if (isUnderScore) |
| 30 | sb << "I"; |
| 31 | return sb.ProduceString(); |
| 32 | } |
| 33 | |
| 34 | } |
| 35 | } |
no test coverage detected