Left Pad Zero Fill
2009-01-09 14:06
302 查看
If you have any specific fields that are lengthy and are left padded with zeroes, you can save your users a lot of time by alowing them to type ONLY the right most numbers.
For example, lets say you have a field INV_ITEM_ID and the length is 18 and left padded with zeroes. The number is 000000000000123456. Your user can just enter 123456 and when they tab out of that field, you left pad all the zero's.
This can be done easily by using the following code.
If INV_ITEM_ID <> “Next” Then
&ITMIDLEN = Len(INV_ITEM_ID);
&FILLLEN = 18 - &ITMIDLEN;
If &ITMIDLEN < 18 And
&ITMIDLEN > 0 Then
&CHECKFIRST = Substring(INV_ITEM_ID,1,1);
If &CHECKFIRST <> “%”;
INV_ITEM_ID = Rept(“0”, &FILLLEN) / INV_ITEM_ID;
End-If;
End-If;
End-If;
You can use this code on any field that is left paded.
For example, lets say you have a field INV_ITEM_ID and the length is 18 and left padded with zeroes. The number is 000000000000123456. Your user can just enter 123456 and when they tab out of that field, you left pad all the zero's.
This can be done easily by using the following code.
If INV_ITEM_ID <> “Next” Then
&ITMIDLEN = Len(INV_ITEM_ID);
&FILLLEN = 18 - &ITMIDLEN;
If &ITMIDLEN < 18 And
&ITMIDLEN > 0 Then
&CHECKFIRST = Substring(INV_ITEM_ID,1,1);
If &CHECKFIRST <> “%”;
INV_ITEM_ID = Rept(“0”, &FILLLEN) / INV_ITEM_ID;
End-If;
End-If;
End-If;
You can use this code on any field that is left paded.
相关文章推荐
- C# string.PadLeft &&String.PadRight方法
- L1-032. Left-pad
- L1-032. Left-pad
- string方法 PadLeft 返回一个新字符串,该字符串通过在此实例中的字符左侧填充指定的 Unicode 字符来达到指定的总长度,从而使这些字符右对齐。 PadRight 右边
- C# 中用 PadLeft、PadRight 补足位数
- string.PadLeft的用法(来自项目中的一个错误)
- 自訂 SQL Server 的 PadLeft、PadRight 字串填補函數
- L1-032. Left-pad
- (字符串输入问题)L1-032. Left-pad
- L1-032 Left-pad(分类讨论思想)
- 7-8 Left-pad(20 分)
- pta Left-pad
- L1-032. Left-pad
- Left-pad
- L1-032. Left-pad
- C#中的PadLeft
- pat:L1-032. Left-pad
- L1-032. Left-pad
- sql函数PadLeft与PadRight代码实例
- php UNSIGNED ZEROFILL