Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


beechc
2017-10-20T13:00:04Z
I often have a requirement to write a string out into a fixed width file as opposed to a delimited file, and would like to have the ability to Pad a string Left or Right with a series of characters. In my case this would typically be a series of 'spaces'. I would see it implemented In a similar manner to the TrimStart and TrimEnd functions that exist but allowing for a definition of number of characters and the character to use to pad the value.

I would foresee it being something like this...

String.PadRight
{STRING(PadRight|TestString1|^|20)}

Result
TestString1^^^^^^^^^

Chris
Sponsor
Forum information
Gary_W
2018-02-02T22:22:38Z
This is ugly but it works. You would be better suited created a .net function or something, but I wanted to see if I could do it strictly in VC for my bag of tricks:

{REGEX(Replace|^^^^^^^^^^^^^^^^^^^^|^.{{STRING(Length|TestString1)}}|TestString1)}

There are 20 (the width of the fixed-width field) '^' characters. From this, replace with your value from the start of the string, for the length of your value.
Scroll to Top