(self, text)
| 689 | return text.replace('\r', '\\r') |
| 690 | |
| 691 | def decode (self, text): |
| 692 | output = [] |
| 693 | i = 0 |
| 694 | if text is None: |
| 695 | return None |
| 696 | size = len(text) |
| 697 | while i < size: |
| 698 | c = text[i] |
| 699 | if c == '\\': |
| 700 | c = text[i + 1:i + 2] |
| 701 | if c == '\\': |
| 702 | output.append('\\') |
| 703 | elif c == 'n': |
| 704 | output.append('\n') |
| 705 | elif c == 'r': |
| 706 | output.append('\r') |
| 707 | else: |
| 708 | output.append('\\' + c) |
| 709 | i += 2 |
| 710 | else: |
| 711 | output.append(c) |
| 712 | i += 1 |
| 713 | return ''.join(output) |
| 714 | |
| 715 | # 安全转行整数 |
| 716 | def readint (self, text): |
no outgoing calls
no test coverage detected