EXTBYTES

The EXTBYTES function extracts a portion of a text expression.

Return Value

TEXT

Syntax

EXTBYTES(text-expression [start [length]])

Arguments

text-expression

A TEXT expression from which a portion is to be extracted. When text-expression is a multiline TEXT value, EXTBYTES preserves the line breaks in the returned value.

start

An INTEGER that represents the byte position at which to begin extracting. The position of the first byte in text-expression is 1. When you omit this argument, EXTBYTES starts with the first byte.

length

An INTEGER that represents the number of bytes to be extracted. When length is not specified, or exceeds the number of bytes from start to the end of text-expression, the part from start to the end of text-expression is extracted.

Examples

Example 14-5 Extracting Text Characters Using Bytes

This example shows how to extract portions of text from the TEXT value 'hellotherejoe'.

  • The statement

    SHOW EXTBYTES('hellotherejoe', 6, 5)
    

    produces the following output.

    there
    
  • The statement

    SHOW EXTBYTES('hellotherejoe', 11)
    

    produces the following output.

    joe