add 't' format string conversion (closes #1065)

to Trim whitespace from the beginning and end of strings.
Example: '{field!t}' becomes 'foo' for 'field' == "  \nfoo\t\r"
This commit is contained in:
Mike Fährmann
2020-10-16 00:37:22 +02:00
parent 5565025221
commit ec61696316
2 changed files with 4 additions and 0 deletions

View File

@@ -495,6 +495,7 @@ class Formatter():
- "u": calls str.upper
- "c": calls str.capitalize
- "C": calls string.capwords
- "t": calls str.strip
- "U": calls urllib.parse.unquote
- "S": calls util.to_string()
- Example: {f!l} -> "example"; {f!u} -> "EXAMPLE"
@@ -525,6 +526,7 @@ class Formatter():
"u": str.upper,
"c": str.capitalize,
"C": string.capwords,
"t": str.strip,
"U": urllib.parse.unquote,
"S": to_string,
"s": str,