FlexPro
HistoryBase
Engineering
Training
Downloads
FlexPro Support
Knowledge
Community
About us
References
Jobs
General Contact
List Of Retailers
FlexPro Support
EN
DE
FR
Placeholder

FlexPro Documentation 2025

StringMid

Takes a substring out of a string starting from a particular position.

Syntax

StringMid(String, Position [ , Length ])

 

The syntax of the StringMid function consists of the following parts:

Part

Description

String

String from which a substring is to be taken.

Permitted data structures are Scalar value, Data series und Data matrix. Supported data types are String.

Position

The position from which the extraction of the substring is to start. The first position in the string is hereby defined as position "0".

Permitted data structures are Scalar value, Data series und Data matrix. All integral data types are permitted.

Length

The length of the substring. The argument is optional. If you omit it, the rest of the string is extracted from the specified position rightward.

Permitted data structures are Scalar value, Data series und Data matrix. All integral data types are permitted.

Remarks

The data type of the result is always String.

The structure of the result corresponds to that of the argument String.

If the length specified exceeds the end of the string, the rest of the string is extracted from the specified position rightward. If the length is less than or equal to zero, an empty string is returned.

If the argument String is a data series or data matrix, the calculation is performed on a per-element basis and the result is either a data series or a data matrix. If the Position argument is a data series or data matrix, then the Position must match the String argument in the number of rows and, if applicable, number of columns. This applies to the Length argument.

If an argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

StringMid("This is an example", 11)

Returns the substring "example".

StringMid("This is an example", 5, 2)

Returns the substring "is".

StringMid({"001-M75_PQ", "002-M33_PQ", "003-M49_PQ"}, 4)

Results in the data series {"M75_PQ", "M33_PQ", "M49_PQ"}.

StringMid({"001-M75_PQ", "002-M33_PQ", "003-M49_PQ"}, 4, 3)

Results in the data series {"M75", "M33", "M49"}.

Dim names = {"4-M75_PQ", "13-M633_PQ", "19-M11850_PQ"}
Dim pos1 = StringFind(names, "-") + 1n
Dim pos2 = StringFind(names, "_")
return StringMid(names, pos1, pos2 - pos1)
 

Results in the data series {"M75", "M633", "M11850"}.

See Also

StringLeft Function

StringRight Function

StringFind Function

StringReverseFind Function

StringConcat Function