We can check whether a string is alphanumeric:
It is also possible to check whether a string contains only letters:
Here's how you check whether a string contains only numbers:
We can also check whether a string only contains spaces:
Speaking of spaces, we can add spaces on either side of a string. Let's add spaces to the right of a string:
To add spaces to the left of a string, the rjust method is used:
The center method is used to center a string in spaces:
We can strip spaces on either side of a string:
blog comments powered by Disqus |