Mid

Extract a substring from a string

Method Signature

Mid(string=[string], start=[integer], count=[integer])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The string to extract from

start

integer

true

The position of the first character to retrieve.

count

integer

true

The number of characters to retrieve.

Examples

Extract month from date

Grabs the month out of a raw date yyyymmdd value.

Run Example

mid( "20001122", "5", "2" );

Result: 11

Additional Examples

Run Example

str = "I Love Boxlang server";
writeOutput( mid( str, 8, 5 ) );
// Member function
str = "Hi buddy, Nice day!";
writeDump( str.mid( 4, 5 ) );

Last updated

Was this helpful?