Capitalize the first letter of a string.
(x)
| 24 | |
| 25 | @keep_lazy_text |
| 26 | def capfirst(x): |
| 27 | """Capitalize the first letter of a string.""" |
| 28 | if not x: |
| 29 | return x |
| 30 | if not isinstance(x, str): |
| 31 | x = str(x) |
| 32 | return x[0].upper() + x[1:] |
| 33 | |
| 34 | |
| 35 | # Set up regular expressions |
no outgoing calls