-
Notifications
You must be signed in to change notification settings - Fork 1
PadStart
jdubs edited this page Oct 21, 2016
·
1 revision
Pads the beginning 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 beginning of the variable value for the length of the Count. For example, if you pad "Four51" with "." for a count of 10 the result would be "..........Four51"
public static void PadStart(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.PadLeft(pad, Convert.ToChar(Character));
}
catch (Exception ex)
{
throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
}
}