substring.asciidoc 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
  2. *Examples*
  3. This example returns the first three characters of every last name:
  4. [source.merge.styled,esql]
  5. ----
  6. include::{esql-specs}/docs.csv-spec[tag=substring]
  7. ----
  8. [%header.monospaced.styled,format=dsv,separator=|]
  9. |===
  10. include::{esql-specs}/docs.csv-spec[tag=substring-result]
  11. |===
  12. A negative start position is interpreted as being relative to the end of the string.
  13. This example returns the last three characters of of every last name:
  14. [source.merge.styled,esql]
  15. ----
  16. include::{esql-specs}/docs.csv-spec[tag=substringEnd]
  17. ----
  18. [%header.monospaced.styled,format=dsv,separator=|]
  19. |===
  20. include::{esql-specs}/docs.csv-spec[tag=substringEnd-result]
  21. |===
  22. If length is omitted, substring returns the remainder of the string.
  23. This example returns all characters except for the first:
  24. [source.merge.styled,esql]
  25. ----
  26. include::{esql-specs}/docs.csv-spec[tag=substringRemainder]
  27. ----
  28. [%header.monospaced.styled,format=dsv,separator=|]
  29. |===
  30. include::{esql-specs}/docs.csv-spec[tag=substringRemainder-result]
  31. |===