str_operations.rst 738 B

1234567891011121314151617181920212223242526272829303132333435
  1. .. _str-ops:
  2. Native string operations
  3. ========================
  4. These ``str`` operations have fast, optimized implementations. Other
  5. string operations use generic implementations that are often slower.
  6. Construction
  7. ------------
  8. * String literal
  9. * ``str(x: int)``
  10. * ``str(x: object)``
  11. Operators
  12. ---------
  13. * Concatenation (``s1 + s2``)
  14. * Indexing (``s[n]``)
  15. * Slicing (``s[n:m]``, ``s[n:]``, ``s[:m]``)
  16. * Comparisons (``==``, ``!=``)
  17. * Augmented assignment (``s1 += s2``)
  18. Methods
  19. -------
  20. * ``s1.endswith(s2: str)``
  21. * ``s.join(x: Iterable)``
  22. * ``s.replace(old: str, new: str)``
  23. * ``s.replace(old: str, new: str, count: int)``
  24. * ``s.split()``
  25. * ``s.split(sep: str)``
  26. * ``s.split(sep: str, maxsplit: int)``
  27. * ``s1.startswith(s2: str)``