PadEnd
jdubs edited this page Oct 21, 2016
·
1 revision
Pads the end of a variable with characters.
SpecName (multiple) The name of the variable for operation result assignment
Count (multiple) The variable containing the number of total characters
Character (constant) The character to pad
ErrorMessage (multiple | optional) The error message to return when any error occurs.
Padding adds the specified character to the end of the variable value until the total number of characters matches the Count. For example, if you pad "Four51" with "!" for a count of 10 the result would be "Four51!!!!"
public static void PadEnd(string SpecName, object Count, object Character, object ErrorMessage)
{
Break();
try
{
var text = Variable(SpecName).Value;
var pad = text.Length + (int)N(Count);
Variable(SpecName).Value = text.PadRight(pad, Convert.ToChar(Character));
}
catch (Exception ex)
{
throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
}
}