Free cookie consent management tool by TermsFeed

a!midb() Function

On This Page

Returns a substring from the middle of the specified text.

Parameters

a!midb( text, start_num, num_bytes, encoding )

Keyword Type Description

text

Text

The text from which the substring will be extracted.

start_num

Number

The positional index in bytes of the first byte of the substring to be returned.

num_bytes

Number

The length in bytes of the substring to extract.

encoding

Text

The character encoding to use when counting bytes. The value must be a valid Preferred MIME Name from the IANA character sets registry. For example, UTF-8, Shift_JIS, or GBK. Default: UTF-8.

Returns

Text

Using the function

The following sections cover important details about the a!midb() function.

Byte indexing

The first byte of the entire text value is considered to have an index = 1.

Using the encoding parameter

The a!midb() function counts bytes using the encoding specified in the encoding parameter. When working with multi-byte character sets such as UTF-8 or Shift_JIS, characters can occupy more than one byte. Specifying the correct encoding ensures the function extracts the expected substring without splitting a multi-byte character.

The encoding value must be a valid Preferred MIME Name from the IANA character sets registry. If omitted, the function uses UTF-8.

Examples

The following examples demonstrate the a!midb() function.

To experiment with examples, copy and paste the expression into an expression rule and click TEST RULE to see the output.

a!midb("boston",4,2) returns to

a!midb("日本語", 3, 2, "Shift_JIS") returns 本

Feature compatibility

The table below lists this function's compatibility with various features in Appian.
Feature Compatibility Note
Portals Compatible
Offline Interfaces Compatible
Sync-Time Custom Record Fields Compatible

Can be used to create a custom record field that only evaluates at sync time.

Real-Time Custom Record Fields Incompatible

Custom record fields that evaluate in real time must be configured using one or more Custom Field functions.

Process Reports Compatible
Process Events Compatible

Can be used to configure a process event node, such as a start event or timer event.

Process Autoscaling Compatible

Can be used in autoscaled processes.

Event Consumer Filter Conditions Compatible

Can be used in filter conditions.

Event Consumer Event Handlers Compatible

Can be used in event handler expressions.

Old versions

There are older versions of this function . You can identify older versions by looking at the name to see if there is a version suffix. If you are using an old version, be sure to refer to the corresponding documentation from the list below.

Old Versions Reason for Update
midb_26r8

Added an encoding parameter to support multi-byte character encodings.

For more on what's changed, see New version details.

To use the latest version of the function, replace the function with a version suffix with a new function reference.

To learn more about how Appian handles this kind of versioning, see the Function and Component Versions page.

Feedback