社区
非技术区
帖子详情
如何把integer转成string?
blue_coco
2002-01-29 09:19:55
请教,Delphi中有没有类似C的sprintf( "03d", 5 );的涵数,其输出为"001"
...全文
786
12
打赏
收藏
如何把integer转成string?
请教,Delphi中有没有类似C的sprintf( "03d", 5 );的涵数,其输出为"001"
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
12 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lxf196921
2002-01-29
打赏
举报
回复
format ('3.3d%',[i])肯定行,我做过
cow8063
2002-01-29
打赏
举报
回复
都对
dregs2002
2002-01-29
打赏
举报
回复
format('%3.0d',[数字]);
jianghuxiaozi
2002-01-29
打赏
举报
回复
inttostr
format
wangb26
2002-01-29
打赏
举报
回复
IntStr := IntToStr(IntNum)
BraveYang
2002-01-29
打赏
举报
回复
可以用FormatFloat('000',5)将就
另外你也可以自己编个函数
blue_coco
2002-01-29
打赏
举报
回复
各为用IntToStr和Format生成的数前面不补零啊!
williexu
2002-01-29
打赏
举报
回复
strNum:=InttoStr(intNum);
dy2712
2002-01-29
打赏
举报
回复
var
i:integer
str:string;
begin
i:=1;
str:=format('%3.0d',[i]);
end;
w19995
2002-01-29
打赏
举报
回复
用format、IntToStr.
torrentwang
2002-01-29
打赏
举报
回复
IntToStr();
format;
lxf196921
2002-01-29
打赏
举报
回复
str:=format('3.3d%',[i]);
肯定行,我用过,记得给分啊。
java
integer
转
string
,为什么不能在Java中将
Integer
转换为
String
?
I found some strange exception:java.lang.ClassCastException: java.lang.
Integer
cannot be cast to java.lang.
String
How it can be possible? Each object can be casted to
String
, doesn't it?The code is:Stri...
string
转换成
integer
的方式及原理
string
转换成
integer
的方式及原理 在看面试题的时候看到该问题,当时由于不清楚, 就查看了下源码,下面分下下源码。 1.
Integer
.parseInt(
String
str)方法 public static int parseInt(
String
s) throws NumberFormatException { //内部默认调用parseIn...
Integer
转换为
String
类型
Integer
i = 2;
String
s = i.to
String
(); 不能使用下面方法强转
Integer
i = 2;
String
s = (
String
) i;
Integer
类型转换为
String
类型,用强制转换,结果报错: Exception in thread "main" java.lang.ClassCastException: java.lang.
Integer
cannot be cast to java.lang.
String
...
String
与
Integer
的相互转化
String
与
Integer
相互转化时,一定要注意空指针异常。
将Java
Integer
转换成
String
类型
查了好几遍了,记录下 There are many ways toconvertan
Integer
to
String
inJavae.g. by using
Integer
.to
String
(int) or by using
String
.valueOf(int), or by using new
Integer
(int).to
String
(), or by using
String
...
非技术区
830
社区成员
53,574
社区内容
发帖
与我相关
我的任务
非技术区
Delphi 非技术区
复制链接
扫一扫
分享
社区描述
Delphi 非技术区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章