private string GetField() { if (String1 != null) { if (String1.Length > Convert.ToInt16(StartChar) + Convert.ToInt16(FieldLength)) { return(String1.Substring(Convert.ToInt16(StartChar) - 1, Convert.ToInt16(FieldLength))); } } return(null); }
/// <summary> /// Pads String1 with necessary zeros to fill TotalWidth number of characters /// </summary> public string AddNumericPadding() { string sRet = String1; if (String1 != null) { if (String1.Length > TotalWidth) { sRet = String1.Substring(0, TotalWidth); } } else { sRet = new String('0', TotalWidth); } return(sRet.PadLeft(TotalWidth, '0')); }
/// <summary> /// Pads String1 with necessary spaces to fill TotalWidth number of characters /// </summary> public string AddPaddingtoEndOfString() { string sRet = String1; if (String1 != null) { if (String1.Length > TotalWidth) { sRet = String1.Substring(0, TotalWidth); } } else { sRet = new String(' ', TotalWidth); } return(sRet.PadRight(TotalWidth)); }