class_docstr: Namespace for string related expressions.
class_docstr_tok: ["Namespace","for","string","related","expressions","."]
docstr: Create subslices of the string values of a String Series.
  
  Parameters
  ----------
  offset
      Start index. Negative indexing is supported.
  length
      Length of the slice. If set to `None` (default), the slice is taken to the
      end of the string.
  
  Returns
  -------
  Expr
      Expression of data type :class:`String`.
  
  Examples
  --------
  >>> df = pl.DataFrame({"s": ["pear", None, "papaya", "dragonfruit"]})
  >>> df.with_columns(
  ...     pl.col("s").str.slice(-3).alias("s_sliced"),
  ... )
  shape: (4, 2)
  ┌─────────────┬──────────┐
  │ s           ┆ s_sliced │
  │ ---         ┆ ---      │
  │ str         ┆ str      │
  ╞═════════════╪══════════╡
  │ pear        ┆ ear      │
  │ null        ┆ null     │
  │ papaya      ┆ aya      │
  │ dragonfruit ┆ uit      │
  └─────────────┴──────────┘
  
  Using the optional `length` parameter
  
  >>> df.with_columns(
  ...     pl.col("s").str.slice(4, length=3).alias("s_sliced"),
  ... )
  shape: (4, 2)
  ┌─────────────┬──────────┐
  │ s           ┆ s_sliced │
  │ ---         ┆ ---      │
  │ str         ┆ str      │
  ╞═════════════╪══════════╡
  │ pear        ┆          │
  │ null        ┆ null     │
  │ papaya      ┆ ya       │
  │ dragonfruit ┆ onf      │
  └─────────────┴──────────┘
docstr_tok: ["Create","subslices","of","the","string","values","of","a","String","Series",".","Parameters","--","--","--","--","--","offset","Start","index",".","Negative","indexing","is","supported",".","length","Length","of","the","slice",".","If","set","to","`","None","`","(","default",")",",","the","slice","is","taken","to","the","end","of","the","string",".","Returns","--","--","--","-","Expr","Expression","of","data","type",":","class",":","`","String","`",".","Examples","--","--","--","--",">",">",">","df","=","pl.DataFrame","(","{","``","s","''",":","[","``","pear","''",",","None",",","``","papaya","''",",","``","dragonfruit","''","]","}",")",">",">",">","df.with_columns","(","...","pl.col","(","``","s","''",")",".str.slice","(","-3",")",".alias","(","``","s_sliced","''",")",",","...",")","shape",":","(","4",",","2",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","s","\u2506","s_sliced","\u2502","\u2502","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","str","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","pear","\u2506","ear","\u2502","\u2502","null","\u2506","null","\u2502","\u2502","papaya","\u2506","aya","\u2502","\u2502","dragonfruit","\u2506","uit","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518","Using","the","optional","`","length","`","parameter",">",">",">","df.with_columns","(","...","pl.col","(","``","s","''",")",".str.slice","(","4",",","length=3",")",".alias","(","``","s_sliced","''",")",",","...",")","shape",":","(","4",",","2",")","\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510","\u2502","s","\u2506","s_sliced","\u2502","\u2502","--","-","\u2506","--","-","\u2502","\u2502","str","\u2506","str","\u2502","\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561","\u2502","pear","\u2506","\u2502","\u2502","null","\u2506","null","\u2502","\u2502","papaya","\u2506","ya","\u2502","\u2502","dragonfruit","\u2506","onf","\u2502","\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"]
code: def slice(self, offset: int, length: int | None = None) -> Expr:
      """
      Create subslices of the string values of a String Series.
  
      Parameters
      ----------
      offset
          Start index. Negative indexing is supported.
      length
          Length of the slice. If set to `None` (default), the slice is taken to the
          end of the string.
  
      Returns
      -------
      Expr
          Expression of data type :class:`String`.
  
      Examples
      --------
      >>> df = pl.DataFrame({"s": ["pear", None, "papaya", "dragonfruit"]})
      >>> df.with_columns(
      ...     pl.col("s").str.slice(-3).alias("s_sliced"),
      ... )
      shape: (4, 2)
      ┌─────────────┬──────────┐
      │ s           ┆ s_sliced │
      │ ---         ┆ ---      │
      │ str         ┆ str      │
      ╞═════════════╪══════════╡
      │ pear        ┆ ear      │
      │ null        ┆ null     │
      │ papaya      ┆ aya      │
      │ dragonfruit ┆ uit      │
      └─────────────┴──────────┘
  
      Using the optional `length` parameter
  
      >>> df.with_columns(
      ...     pl.col("s").str.slice(4, length=3).alias("s_sliced"),
      ... )
      shape: (4, 2)
      ┌─────────────┬──────────┐
      │ s           ┆ s_sliced │
      │ ---         ┆ ---      │
      │ str         ┆ str      │
      ╞═════════════╪══════════╡
      │ pear        ┆          │
      │ null        ┆ null     │
      │ papaya      ┆ ya       │
      │ dragonfruit ┆ onf      │
      └─────────────┴──────────┘
  
      """
      return wrap_expr(self._pyexpr.str_slice(offset, length))
  
imports: from __future__ import annotations
  import warnings
  from typing import TYPE_CHECKING
  import polars._reexport
  from polars import functions
  from polars.datatypes import Date, Datetime, Int32, Time, py_type_to_dtype
  from polars.exceptions import ChronoFormatWarning
  from polars.utils._parse_expr_input import parse_as_expression
  from polars.utils._wrap import wrap_expr
  from polars.utils.deprecation import deprecate_renamed_function, deprecate_renamed_parameter, rename_use_earliest_to_ambiguous
  from polars.utils.various import find_stacklevel
label_desc: Use image node_id 38 for calling the ExprStringNameSpace obj's underlying member method code with example usage: obj.slice(offset, length) and returns: wrap_expr