@MiddleBack (Formula Language)

Returns any substring from the middle of a string. The middle is found by scanning the string from right to left, and parameters determine where the middle begins and ends.

Syntax

@MiddleBack( string ; offset ; numberchars ) @MiddleBack( string ; offset ; endstring ) @MiddleBack( string ; startString ; endstring ) @MiddleBack( string ; startString ; numberchars )

Parameters

string

Text or text list. Any string.

offset

Number. A character position in string that indicates where you want the middle to begin, always counting from right to left. The middle begins one character after the offset. Always add 1 to this number; the end of the string is marked by one non-visible character and must be counted in the offset.

startString

Text. A substring of string that indicates where you want the middle to begin, always counting from right to left. The middle begins one character after the end of startString.

numberchars

Number. The number of characters that you want in the middle. If numberchars is negative, the middle starts at offset or startString and continues from right to left. If numberchars is positive, the middle starts one character past the offset or startString and continues from left to right.

endstring

Text. A substring of string that indicates the end of the middle. @MiddleBack returns all the characters between offset and endstring, or between startString and endstring.

Usage

If the first parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.

Return value

middle

Text or text list. The substring from the middle of string, which begins at the offset or startString you specify and ends at the endstring you specify, or after the numberchars have been reached.

Examples

  1. This example returns Alt if the content of the Author field is Timothy Altman.
    @MiddleBack(Author;" ";3)
  2. This example returns an empty string if the content of the Author field is any string with no spaces, for example "Smith."
    @MiddleBack(Author;" ";3)
  3. This example returns" from right to left" with a space before "from."
    @MiddleBack("Middleback searches the string from right to left"; "ing";25)
  4. This example returns "searches the string ."
    @MiddleBack("@MiddleBack searches the string from right to left"; "from"; -20)
  5. This example returns " is the " with spaces before and after "is the." The return string is everything from the fifth to the last character through the character after "This."
    @MiddleBack("This is the text"; 5; "This")
  6. This example returns " the " with spaces before and after "the." The return string is everything before "text" and after "is."
    @MiddleBack("This is the text"; "text"; "is")
  7. This example returns "world" and "time" in a list. The offset is the end of each text element and the end text is the last space.
    @MiddleBack("Hello world" : "This is the time"; 0; " ")