Sidebar

Home



Expressions V4


Tutorials

How-To

Reference

  Lexical basics
  Type system
  Variables and assignment
  Operators
  Expression rules
  Control flow
  Functions
  Built-in functions
   None and NaN
   Arithmetic
   Algebra
   Logarithmic and Exponential
   Trigonometric
   Rounding and Centering
   Strings
   Output, Formatting, Clipboard, and Errors
   Dialog Functions
   Platform and Paths
  Methods and properties
  Built-in methods
   Common Value Methods
   Number Methods
   String Basic Methods
   String Slice Methods
   String Parsing Methods
   String Formatting Methods
   String Regex Methods
   String Trim and Case Methods
  Objects
  Built-in objects
   Global objects
    settings
    controller
    session
    python
   Collections
    array
    map
    bytes
   File Format I/O
    image_data
    image_stream
   Utils
    crypto
    timer
   Comm
    serial
   Dialogs
    file_open
    file_save
    msg_ok
    msg_ok_cancel
    msg_yes_no
    msg_password
   GUI objects
    window
    panel
    group
    splitpanel
    label
    textbutton
    drawablebutton
    togglebutton
    togglegroup
    textinput
    textedit
    numinput
    slider
    combobox
    listbox
    progressbar
    led
    separator
    menu
    image
    snake
  Classes and user-defined objects
  Include system
  Error model
  Execution model and sessions
  Host integration
  Limits and performance
  Formal reference
  Glossary

Cookbook

exprv4:reference:methods:string_slice_methods



String Slice Methods

String slice methods return parts of a string.

Indexes are zero-based.


substr(start)

Returns text from `start` to the end of the string.

Argument Type Description
`start` number Zero-based start index.

Returns: string.

Example:

'abcdef'.substr(2);        // 'cdef'

substr(start, count)

Returns `count` characters starting at `start`.

Argument Type Description
`start` number Zero-based start index.
`count` number Number of characters to return.

Returns: string.

Example:

'abcdef'.substr(2, 3);     // 'cde'

slice(start)

Alias for `substr(start)`.

Argument Type Description
`start` number Zero-based start index.

Returns: string.

Example:

'abcdef'.slice(2);         // 'cdef'

slice(start, count)

Alias for `substr(start, count)`.

Argument Type Description
`start` number Zero-based start index.
`count` number Number of characters to return.

Returns: string.

Example:

'abcdef'.slice(2, 3);      // 'cde'

subspan(start)

Returns text from `start` to the end of the string.

Argument Type Description
`start` number Zero-based start index.

Returns: string.

Example:

'abcdef'.subspan(2);       // 'cdef'

subspan(start, end)

Returns text from `start` up to `end`.

Argument Type Description
`start` number Zero-based start index.
`end` number End index.

Returns: string.

Example:

'abcdef'.subspan(2, 5);    // 'cde'

span(start)

Alias for `subspan(start)`.

Argument Type Description
`start` number Zero-based start index.

Returns: string.

Example:

'abcdef'.span(2);          // 'cdef'

span(start, end)

Alias for `subspan(start, end)`.

Argument Type Description
`start` number Zero-based start index.
`end` number End index.

Returns: string.

Example:

'abcdef'.span(2, 5);       // 'cde'

before(text)

Returns the part of the string before the first matching separator text.

Argument Type Description
`text` any Separator text.

Returns: string.

Example:

'key=value'.before('=');   // 'key'

after(text)

Returns the part of the string after the first matching separator text.

Argument Type Description
`text` any Separator text.

Returns: string.

Example:

'key=value'.after('=');    // 'value'

Previous: String Basic Methods

Next: String Parsing Methods

exprv4/reference/methods/string_slice_methods.txt · Last modified: by 127.0.0.1

Page Tools