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 ...
随机推荐
- 【转】详解linux vi命令用法
功能最强在的编辑器--vi vi是所有UNIX系统都会提供的屏幕编辑器,它提供了一个视窗设备,通过它可以编辑文件.当然,对UNIX系统略有所知的人, 或多或少都觉得vi超级难用,但vi是最基本的编辑器 ...
- Anaconda+django写出第一个web app(八)
今天来实现网站的登入和登出功能. 首先我们需要在urls.py中添加路径,注意此处的路径和在导航栏中设置的文字路径保持一致: from django.urls import path from . i ...
- 2016最新的中国省市区三级数据库表.sql mssql
/****** Object: Table [dbo].[t_Area] Script Date: 09/10/2016 09:35:46 ******/ SET ANSI_NULLS ON GO S ...
- Ubuntu 12.04将默认集成Landscape管理套件【转】
转自:https://imtx.me/archives/1702.html 今天,我像往常一样对我的Ubuntu 12.04 Beta进行了一次常规升级,然后我发现在系统设置当中多了一个图标,叫「Ma ...
- 关于spring中Assert的应用(方法入参检测工具类)
关于spring中Assert的应用(方法入参检测工具类) Web 应用在接受表单提交的数据后都需要对其进行合法性检查,如果表单数据不合法,请求将被驳回.类似的,当我们在编写类的方法时,也常常需要对方 ...
- python抓取内涵段子文章
# coding:utf-8 from urllib.request import urlretrieve import threading import requests from bs4 impo ...
- jquery-事件之页面框架加载后自动执行
jQuery事件之页面框架加载后自动执行 1)概述 HTML执行是按自上而下编译,而<script>一般写在body结束之前.如果在HTML加载的过程中卡住, 比如加载图片等,没有显示出来 ...
- 全键盘操作Windows
计算机机用户在使用计算机的时候,是用键盘多一点?还是用鼠标多一点?如果是专业打字员,应该会说他使用键盘多一点,除此之外,多数人都会告诉你,他已经离不开鼠标了,没有鼠标,就不会操作电脑. 如果某一天 ...
- nodejs查询数据库后,获取result结果集并赋值返回
nodejs获取了查询结果,但不能返回出去, 情形如下: var query = function (path,id,param,sqlWhere,res){ var aa = 111;var sql ...
- redux,react-redux、redux-thunk、redux-logger、redux-promise实例
使用的是create-react-app脚手架 package.json增加反向代理 "proxy": { "/v4": { "target" ...