| 1560 | } |
| 1561 | |
| 1562 | String Utility::EscapeString(const String& s, const String& chars, const bool illegal) |
| 1563 | { |
| 1564 | std::ostringstream result; |
| 1565 | if (illegal) { |
| 1566 | for (char ch : s) { |
| 1567 | if (chars.FindFirstOf(ch) != String::NPos || ch == '%') { |
| 1568 | result << '%'; |
| 1569 | HexEncode(ch, result); |
| 1570 | } else |
| 1571 | result << ch; |
| 1572 | } |
| 1573 | } else { |
| 1574 | for (char ch : s) { |
| 1575 | if (chars.FindFirstOf(ch) == String::NPos || ch == '%') { |
| 1576 | result << '%'; |
| 1577 | HexEncode(ch, result); |
| 1578 | } else |
| 1579 | result << ch; |
| 1580 | } |
| 1581 | } |
| 1582 | |
| 1583 | return result.str(); |
| 1584 | } |
| 1585 | |
| 1586 | String Utility::UnescapeString(const String& s) |
| 1587 | { |
nothing calls this directly
no test coverage detected