How to add Leading Zeroes to a Number (Delphi Format)
How to add Leading Zeroes to a Number (Delphi Format)
Here's how convert (an integer) number to a string by adding an amount of leading zeroes.
Suppose you are developing a database application, and you need to operate on, let's say, a customer number, where each number needs to be exactly 10 digits "long" - but you have customer numbers of 2,4,7, etc. (<10) digits.
The AddLeadingZeroes function accepts two parameters: aNumber is the number that needs to have exactly Length characters (if less, add leading zeroes).
function AddLeadingZeroes(const aNumber, Length : integer) : string;
begin
result := SysUtils.Format('%.*d', [Length, aNumber]) ;
end;
Usage:
AddLeadingZeroes(, ) ;
Will result in a '0000002005' string value.
How to add Leading Zeroes to a Number (Delphi Format)的更多相关文章
- Bash: Removing leading zeroes from a variable
old=" # sed removes leading zeroes from stdin new=$(echo $old | sed 's/^0*//')
- spring boot 当参数传入开头多个0时,报错:JSON parse error: Invalid numeric value: Leading zeroes not allowed
原因是: Jackson解析json配置的问题 在配置文件中设置下: spring.jackson.parser.allow-numeric-leading-zeros=true
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
- Codeforces 622B The Time 【水题】
B. The Time time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- oracle 日期格式化 TO_CHAR (datetime) 修饰语和后缀
Datetime Format Element Suffixes Suffix Meaning Example Element Example Value TH Ordinal Number DDTH ...
- Educational Codeforces Round 7 B
Description You are given the current time in 24-hour format hh:mm. Find and print the time after a ...
- codeforces 622B B. The Time
B. The Time time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- poj3301 三分
Texas Trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4998 Accepted: 1559 Descri ...
- poj 3301 Texas Trip(几何+三分)
Description After a day trip with his friend Dick, Harry noticed a strange pattern of tiny holes in ...
随机推荐
- c++刷题(30/100)
题目一:合并两个排序的链表 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则. 思路:利用两个指针cur1,cur2来指分别向两个链表中当前较小的和当前较大的 ...
- Memcached命令:简单获取缓存value用法
Memcached:命令用法1.cmd 输入telnet ip 端口 进入memcached服务端窗口比如:xxx.Token_T1435622096xxx为key获取此key的memcached ...
- IE 11 使用 flexbox 垂直居中 bug
不要使用 min-height 改为 height 即可 caniuse: https://caniuse.com/#search=flexbox
- pytorch之LSTM
from:http://pytorch-cn.readthedocs.io/zh/latest/package_references/torch-nn/#recurrent-layers class ...
- Redis配置文件介绍
Redis在源码包中存放了一个Redis配置实例文件,文件中对各个配置点进行了简单的介绍,我也通过这个文件来对Redis的一些配置进行一些简单介绍. 一.UNITS(单位)[了解] 1.Redis服务 ...
- python3 web测试模块selenium
selenium是一个用于web应用程序测试工具,selenium测试直接运行在浏览器中,就像真正的用户在操作一样,支持的浏览器包括IE(7,8,9,10,11),mozilla firefox,sa ...
- linux调试工具glibc的演示分析-core dump double free【转】
转自:http://www.cnblogs.com/jiayy/p/3475544.html 偶然中发现,下面的两端代码表现不一样 void main(){ void* p1 = malloc(32) ...
- pymongo创建索引
from database import db db_list = ["table1", "table2", "table3", " ...
- 初步认识mitmproxy(一)
在windows机器上,经常用的最多的是fiddler工具,很强大,图形化界面,使用方便.简单:在mac上,Charles 类似fiddler工具,同样是易于操作的图形化界面,同样都是通过代理的方式实 ...
- Fiddler实现移动端手机抓包
Fiddler是一个http调试代理,它能 够记录所有的你电脑和互联网之间的http通讯,Fiddler 可以也可以让你检查所有的http通讯,设置断点,以及Fiddle 所有的“进出”的数据(指co ...