====== PadStart(text, pad_char, total_len) ====== Category: Text function \\ =====Description===== This function pads the beginning of //text// with //pad_char// up to a total length defined by //total_len//. \\ =====Use cases===== This function is useful for creating text values from numbers that require leading zeros. Create fixed width datasets by padding blank spaces to the front of values in each column. \\ =====Arguments===== ^Argument^Type^Description^ |text|Text|The text value to be padded.| |pad_char|Text (a single character)|The character to append to the start of //text// repeatedly until the total string length of //total_len// is reached.| |total_len|Number|The total length of the result string including //text// plus all repeated instances of //pad_text//.| **Return value type:** Text \\ =====Remarks===== //text// and //pad_char// are implicitly converted to text values if required. Entering a value for //pad_char// longer than a single character results in an error message. Entering a value for //total_len// equal to or less than the length of //text// simply returns the value of //text//. \\ =====Examples===== padstart('99', '0', 5) //Returns '00099' padstart('1000', '0', 3) //Returns '1000' (Result length entered (3) is less than the length of '1000' (4)) \\ Create a fixed-width dataset from [Col1], [Col2] and [Col3] where [Col1] must be 5 characters wide, [Col2] must be 20 characters wide, and [Col3] must be 12 characters wide: padstart([Col1], ' ', 5) padstart([Col2], ' ', 20) padstart([Col3], ' ', 12) \\ ===== See also ===== * [[syntax:functions:padend|PadEnd(text, pad_char, total_len)]]