The mgiInlineString Tag

Tag Behavior

Use the mgiInlineString tag to perform operations on text. (see also mgiString).


Tag Syntax

The mgiInlineString tag has twenty modes. Each mode has different required and optional parameters. The modes of mgiInlineString are:

  • urlEncode - The urlEncode mode replaces URL reserved characters with encoded versions of those characters.
  • urlDecode - The urlDecode mode replaces encoded URL characters with URL reserved characters.
  • htmlEncode - The htmlEncode mode replaces HTML reserved characters with an encoded version of those characters.
  • htmlDecode - The htmlDecode mode replaces encoded HTML characters with HTML reserved characters.
  • toUpper - The toUpper mode changes the string to all capital letters.
  • toLower - The toLower mode changes the string to all lowercase letters.
  • substring - The substring mode extracts and displays a string of characters.
  • replace - The replace mode finds a string and replaces it with another string.
  • insert - The insert mode inserts a new string of text at a specified location in the string.
  • append - The append mode adds characters to the end of the string.
  • prepend - The prepend mode adds characters to the beginning of the string.
  • trimLeft - The trimLeft mode removes whitespace from the beginning of a string.
  • trimRight - The trimRight mode removes whitespace from the end of a string.
  • trim - The trim function removes whitespace from the beginning and end of a string.
  • getLength - The getLength mode displays the total length of the string.
  • split - The split mode extracts values with a delimiter.
  • regularExpression - The regularExpression mode searches a string for a regular expression pattern.
  • getWordCount - The getWordCount mode displays the total number of words in a string.
  • getCharacterCount - The getCharacterCount mode displays the total number of characters in a string that are not carriage returns or linefeeds.
  • noOperation - The noOperation mode does not change the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

URLEncode Mode

The urlEncode mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="urlEncode" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to encode.
  • mode - The mode is the function that the mgiInlineString tag performs. In "urlEncode" mode, the mgiInlineString tag replaces all URL reserved characters with an encoded version of the character (e.g., spaces in the URL are replaced with %20 characters).

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

URLDecode Mode

The urlDecode mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="urlDecode" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to decode.
  • mode - The mode is the function that the mgiInlineString tag performs. In "urlDecode" mode, the mgiInlineString tag replaces all encoded characters with URL reserved characters (e.g., %20 characters are replaced with spaces).

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

HTMLEncode Mode

The htmlEncode mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="htmlEncode" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to encode.
  • mode - The mode is the function that the mgiInlineString tag performs. In "htmlEncode" mode, the mgiInlineString tag replaces all HTML reserved characters with an encoded version of the character (e.g., quotation marks are replaced with &quot; characters).

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

HTMLDecode Mode

The htmlDecode mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="htmlDecode" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to decode.
  • mode - The mode is the function that the mgiInlineString tag performs. In "htmlDecode" mode, the mgiInlineString tag replaces all encoded characters with HTML reserved characters (e.g., &quot; characters are replaced with quotation marks).

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

ToUpper Mode

The toUpper mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="toUpper" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to change.
  • mode - The mode is the function that the mgiInlineString tag performs. In "toUpper" mode, the mgiInlineString tag changes the string to all capital letters.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

ToLower Mode

The toLower mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="toLower" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to change.
  • mode - The mode is the function that the mgiInlineString tag performs. In "toLower" mode, the mgiInlineString tag changes the string to all lowercase letters.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Substring Mode

The substring mode of the mgiInlineString tag has four required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="substring" 
beginningIndex="Number" length="Number" quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "substring" mode, the mgiInlineString tag extracts and displays a string of characters specified by the numeric location of the first character in the string and the length of the string.
  • beginningIndex - The beginningIndex is an integer that indicates the numeric location of the first character to extract and display. The value of the beginningIndex value must be less than the total length of the string. For example, to extract the numeric month from the string "19991025", the beginningIndex would be "5".
  • length - The length is an integer that indicates the length in characters of the string including the beginningIndex. For example, to extract the numeric month from the string "19991025", the beginningIndex would be "5" and the length would be "2".

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Replace Mode

The replace mode of the mgiInlineString tag has four required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="replace" 
stringToReplace="String" replacementString="String" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "replace" mode, the mgiInlineString tag finds a string and replaces it with another string.
  • stringToReplace - The stringToReplace is the text that will be found and replaced by the replacement string. To find the escape characters carriage returns, line feeds, and tabs, use the appropriate Escaped String format.
  • replacementString - The replacementString is the text that will replace any string found by the stringToReplace parameter. To find the escape characters carriage returns, line feeds, and tabs, use the appropriate Escaped String format.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Insert Mode

The insert mode of the mgiInlineString tag has four required parameters and one optional parameterg. The tag form is:

<mgiInlineString string="String"  mode="insert" 
stringToInsert="String" index="Integer" quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to change.
  • mode - The mode is the function that the mgiInlineString tag performs. In "insert" mode, the mgiInlineString tag inserts string of characters at a specified location in the string.
  • stringToInsert - The stringToInsert is the text that is inserted at the location specified in the index parameter. To insert escape characters such as carriage returns, line feeds, and tabs, use the appropriate Escaped String format.
  • index - The index is the integer of the character location where the string is inserted. For example, in the string "abcdef", "c" is at the 3 index position.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Append Mode

The append mode of the mgiInlineString tag has three required parameters and one optional parameterg. The tag form is:

<mgiInlineString string="String" mode="insert" 
stringToAppend="String" quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to change.
  • mode - The mode is the function that the mgiInlineString tag performs. In "append" mode, the mgiInlineString tag adds characters to the end of the string.
  • stringToAppend - The stringToAppend is the text that is appended to the end of the string. To insert escape characters such as carriage returns, line feeds, and tabs, use the appropriate Escaped String format.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Prepend Mode

The prepend mode of the mgiInlineString tag has three required parameters and one optional parameterg. The tag form is:

<mgiInlineString string="String" mode="insert" 
stringToPrePend="String" quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to change.
  • mode - The mode is the function that the mgiInlineString tag performs. In "prepend" mode, the mgiInlineString tag adds characters to the beginning of the string.
  • stringToPrepend - The stringToPrepend is the text that is prepended to the beginning of the string. To insert escape characters such as carriage returns, line feeds, and tabs, use the appropriate Escaped String format.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

TrimLeft Mode

The trimLeft mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="trimLeft" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to trim.
  • mode - The mode is the function that the mgiInlineString tag performs. In "trimLeft" mode, the mgiInlineString tag removes all whitespace (including spaces, tabs and returns) from the beginning of a string.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

TrimRight Mode

The trimRight mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="trimRight" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to trim.
  • mode - The mode is the function that the mgiInlineString tag performs. In "trimRight" mode, the mgiInlineString tag removes all whitespace (including spaces, tabs and returns) from the end of a string.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Trim Mode

The trim mode of the mgiInlineString tag has a beginning tag with two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="trim" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to trim.
  • mode - The mode is the function that the mgiInlineString tag performs. In "trim" mode, the mgiInlineString tag removes all whitespace (including spaces, tabs and returns) from the beginning and end of a string.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

GetLength Mode

The getLength mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="getLength" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "getLength" mode, the mgiInlineString tag displays the total length of the string.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

Split Mode

The split mode of the mgiInlineString tag has a beginning tag with four required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="split" 
delimiter="Character" index="Integer" quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "split" mode, the mgiInlineString tag extracts values with a delimiter.
  • delimiter - The delimiter is the character that separates each part of the string. To specify escape characters such as carriage returns, line feeds, and tabs as delimiters use the appropriate Escaped String format.
  • index - The index is the number of the value to extract. For example, in the following comma-delimited list, an index of "2" will extract the second value of "Smith".
Bob,Smith,919-225-6329,919-225-6330

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

RegularExpression Mode

The regularExpression mode of the mgiInlineString tag has a beginning tag with four required parameters and two optional parameterg. The tag form is:

<mgiInlineString string="String" mode="regularExpression" 
regularExpression="RE Value" beginningIndex="Integer" 
quoteResult="Yes/No" resultVariableName="Name">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "regularExpression" mode, the mgiInlineString tag searches a string for a regular expression pattern.
  • regularExpression - The regularExpression is the regular expression pattern to search for in the string. Create a regular expression pattern using regular expression symbols.
  • beginningIndex - The beginningindex is an integer that indicates the numeric location in the string to begin searching. The value of the beginningIndex value must be less than the total length of the string. For example, a beginningIndex of "5" would start searching at the "e" in the string "abcdefghij".

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.
  • resultVariableName - The resultVariableName is the name prepended to result variables that contain information about the search. You may choose any name for the result variable prefix. To display result variables use the mgiGet tag. In the following list of available result variables, the resultVariableName prefix is "resultvar". For example, if your resultVariableName is "Email", then the page variable that contains the length of the full match would be named "Email_0_length". Result variables are created and available anywhere on the page after the mgiInlineString tag. The pound signs (#) represent the regular expression subgroup number (from 1 to 9). Zero (0) is the main subgroup that is matched. (Use the mgiGet tag to display variable information.)
    • resultvar - The full match returned by the regular expression.
    • resultvar_0_index - The beginning index of the full match.
    • resultvar_0_length - The length of the full match.
    • resultvar_# - The # subgroup of the match. # can be 1 through 9.
    • resultvar_#_index - The beginning index of the # subgroup match.
    • resultvar_#_length - The length of the # subgroup match.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

GetWordCount Mode

The getWordCount mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="getWordCount" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "getWordCount" mode, the mgiInlineString tag displays the total number of words in a string

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

GetCharacterCount Mode

The getCharacterCount mode of the mgiInlineString tag has a beginning tag with two required parameters and one optional parameterg. The tag form is:

<mgiInlineString string="String" mode="getCharacterCount" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to search.
  • mode - The mode is the function that the mgiInlineString tag performs. In "getCharacterCount" mode, the mgiInlineString tag displays the total number of characters in a string that are not carriage returns or linefeeds.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage

NoOperation Mode

The noOperation mode of the mgiInlineString tag has two required parameters and one optional parameter. The tag form is:

<mgiInlineString string="String" mode="noOperation" 
quoteResult="Yes/No">

Required Parameter:

  • string - The string is the string of text to use.
  • mode - The mode is the function that the mgiInlineString tag performs. In "noOperation" mode, the mgiInlineString tag does not change the string. The noOperation function can be used in conjunction with the quoteResult parameter to only enter quote marks around the string.

Optional Parameters:

  • quoteResult - The quoteResult parameter determines if the processed string is wrapped in quotes. If the quoteResult parameter value is "Yes", then quote marks are added to the beginning and end of the string. If the quoteResult parameter value is "No", then the quote marks are not added to the string.

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage


Example Usage and Output

URLDecode Mode

<mgiInlineString string={mgiPathArgument name="Address"} 
mode="urlDecode">

In this example, a path argument value is URL decoded for special characters.

Split Mode

<mgiInlineString string="blue,orange,green,purple,red" 
mode="split" delimiter="," index="3">

In this example, the third value in a comma-delimited list of values is displayed. The third value from the list in this example is "green".

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage


Suggested Usage

  • Form Processing
  • Dynamic Content

Return to the mgiInlineString Mode Menu | Examples and Output | Suggested Usage


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]