FormatString

jdubs edited this page Oct 21, 2016 · 1 revision

Table of Contents

Overview

Takes an array of values or variables and formats to the input of the Format parameter. For example, if you wanted to format an address you could do the following:

SpecName = "CSZ"

Format = "{0}, {1} {2}-{3}"

Params = {City}{State}{Zip}{6746}

Parameter notes: The , represents a comma. The City, State and Zip in the Params parameter are variables in the Pageflex project. The 6746 is a hard coded value.

The output would be: Bloomington, MN 55349-6746

Parameters

SpecName (multiple) The name of the variable for operation result assignment

Format (multiple) The format string to apply to all parameters. Ex: {0} in the {1}

Params (constant) The parameter array applied to the format. Ex: {Variable}{Text}

ErrorMessage (multiple | optional) The error message to return when any error occurs.

Synopsis

All values bracketed in {} are first evaluated as project variables. If the variables are not found it is treated as a hard coded string value. Params are zero based index. Meaning the {0} would be the first item bracketed in the Params parameter.

Source Code

public static void FormatString(string SpecName, object Format, object Params, object ErrorMessage)
{
	Break();
	try
	{
		Variable(SpecName).Value = String.Format((string)Format, ParseArray(Params));
	}
	catch (Exception ex)
	{
		throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
	}
}

Referenced Methods

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.