Release commonly used code blocks. Similarly, it is only suitable for beginners. It is estimated that there are already a lot of code blocks in the hands of veterans.
During application, we often need to fill in spaces or 0 before or after a string, which is similar to the PADL and padr functions in oralce, such as completing two places in the acquired month, the obtained ticket number is supplemented with 11 digits (the first digit is supplemented with 0. so I implemented these two small functions myself.
// Copyright (c) hydonlee. For details, enter the original address // Add to the left, EX: PADL ('20170', 5, '0 ') = & gt; 00123 function PADL (asource: string; alimit: integer; apadchar: Char = ''): string; var I: integer; begin result: = asource; for I: = 1 to alimit-length (result) Do begin result: = apadchar + result; end; // copyright (c) hydonlee, ex: padr ('20170', 5, '0') => 123 function padr (asource: string; alimit: integer; apadchar: Char = ''): string; vaR I: integer; begin result: = asource; for I: = 1 to alimit-length (result) Do begin result: = Result + apadchar; end;
Copyright (c) hydonlee