极弱的问题(50分)

S

squire

Unregistered / Unconfirmed
GUEST, unregistred user!
如何把一个整数,变成定长的string

把12 变成000000012
把123变成000000123
当然可以编程解决
想找一个类似FormatDate('yyyy/mm/dd',date)这样的函数,delphi里有吗?
 
rightstr(('00000000000'+inttostr(intnum)),你要的位数)
 
function FormatDateTime(const Format: string;
DateTime: TDateTime): string;
 
这个函数在哪里?我怎么找不到,笨笨的说
 
Formats a TDateTime value.
Unit
SysUtils
Category
date/time routines
function FormatDateTime(const Format: string;
DateTime: TDateTime): string;
Description
FormatDateTime formats the TDateTime value given by DateTime using the format given by Format. See Date-Time format strings for more information.
If the string specified by the Format parameter is empty, the TDateTime value is formatted as if a 'c' format specifier had been given.
 
SysUtils 中,你打开help 查找就可以了啊
 
formatdatetime('yyyy/mm/dd',now)
 
呵呵,谢了,给分
 
rightstr可以
或者自己写程序:
str:=InttoStr(mun);
while length(str) < 你要的位数 do
str := '0' + str;
 
顶部