/// <summary> /// Sets the value of the counter to the given value or zero. /// </summary> /// <param name="name">The counter.</param> /// <param name="value">The value being set, or zero.</param> /// <returns>An empty string or an error message.</returns> private string Set(string name, string value) { if (value == "") { value = "0"; } if (!GenUtilities.IsNumeric(value)) { return("<<<<< Set: Counter '" + value + "' is not numeric >>>>>"); } _map[name] = long.Parse(value); return(""); }
/// <summary> /// Subtracts the value or 1 from the named counter. /// </summary> /// <param name="name">The counter.</param> /// <param name="value">The amount being subtracted - 1 if blank.</param> /// <returns>An empty string or an error message.</returns> private string Sub(string name, string value) { if (!_map.ContainsKey(name)) { return("<<<<< Sub: Counter " + name + " not defined >>>>>"); } if (value == "") { value = "1"; } else if (!GenUtilities.IsNumeric(value)) { return("<<<<< Sub: Counter '" + value + "' is not numeric >>>>>"); } _map[name] = _map[name] - long.Parse(value); return(""); }
/// <summary> /// Cuts the specified substring out of the given string. /// </summary> /// <param name="value1">The original string.</param> /// <param name="value2">The string being cut out.</param> /// <returns>The edited string.</returns> private static string CutString(string value1, string value2) { return(GenUtilities.CutString(value1, value2)); }
/// <summary> /// Surrounds the given string with single quotes. Embedded quotes are doubled. /// </summary> /// <param name="value">The string being quoted.</param> /// <returns>The quoted string.</returns> private static string QuoteString(string value) { return(GenUtilities.QuoteString(value)); }
/// <summary> /// Checks the condition, and if not empty returns the second parameter else the third. /// </summary> /// <param name="condition">The condition.</param> /// <param name="value0">The value returned if the condition is not empty.</param> /// <param name="value1">The value returned if the condition is empty.</param> /// <returns>The conditional string.</returns> private static string Cond(string condition, string value0, string value1) { return(GenUtilities.Cond(condition, value0, value1)); }
/// <summary> /// Checks if the first parameter contains the second. The comparison is case insensitive. /// </summary> /// <param name="container">The text being examined.</param> /// <param name="contained">The text being sought.</param> /// <returns>The container text if the sought text is contained, and an empty string otherwise.</returns> private static string Contains(string container, string contained) { return(GenUtilities.Contains(container, contained)); }
/// <summary> /// Decapitalize the first character of an identifier. /// </summary> /// <param name="value">The identifier being transformed.</param> /// <returns>The transformed identfier text.</returns> private static string Decapitalize(string value) { return(GenUtilities.Decapitalize(value)); }
/// <summary> /// Turns an identifier into a list of words. Words are identified by capitals (Camel Case), numerics and underscores or hyphens. /// Words after the first are decapitalized. /// </summary> /// <param name="value">The identifier being transformed.</param> /// <returns>The transformed identfier text.</returns> private static string UnIdentifierLc(string value) { return(GenUtilities.UnIdentifierLc(value)); }
/// <summary> /// Determines if the given string is a valid identifier, and if not to surround it with quotes. /// </summary> /// <param name="value"></param> /// <returns></returns> private static string StringOrName(string value) { return(GenUtilities.StringOrName(value)); }