Advertisement
naser2345

Python String Methods

Aug 27th, 2020
1,571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.43 KB | None | 0 0
  1. # ------------------------------------------------------[[String Methods]]------------------------------------------------------------#
  2. #  len()                               ---> Return the length of the text.
  3. #  strip(), lstrip(), rstrip()         ---> Remove the specific characters like whitespaces that occur continously after each other.
  4. #  capitalize(), title(), istitle()    ---> Captialize will capital the first letter, title will capital each letter of new word and letters after numbers, istitle will check if its in title format.
  5. #  zfill(len)                          ---> Fill the numbers as specific format.
  6. #  upper(), lower()                    ---> Uppercase or lowercase all text.
  7. #  split(), rsplit()                   ---> Split text from right or left into list.
  8. #  center(char)                        ---> Center the text from two sides.
  9. #  count(word)                         ---> Count the occurances of specfic word.
  10. #  swapcase()                          ---> Swap cases from Capital to Small and vice versa.
  11. #  startswith()                        ---> Checks if text starts with specific character.
  12. #  endswith()                          ---> Checks if text ends with specific character.
  13. #  index(), find()                     ---> Index returns error if not found, Find returns -1 if not found.
  14. #  rjust(), ljust()                    ---> Justify text from right or left with specific charcter.
  15. #  splitlines()                        ---> Splits text on end of lines.
  16. #  expandtabs()                        ---> Controls the spaces with \t escape character.
  17. #  isspace()                           ---> Checks if the specific character is space.
  18. #  islower()                           ---> Checks if the specific character is capital.
  19. #  isupper()                           ---> Checks if the specific character is small.
  20. #  isidentifier()                      ---> Checks if text is able to be a variable name.
  21. #  isalpha()                           ---> Checks if text include alphabits charcters only.
  22. #  isnum()                             ---> Checks if text include numbers charcters only.
  23. #  replace(old val, new val, count)    ---> Replaces old value into new value with specific number of times.
  24. #  "seperator".join(list || tuple)     ---> Joins list or table items with specific seperator.
  25. # ------------------------------------------------------------------------------------------------------------------------------------#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement