萍聚社区-德国热线-德国实用信息网

 找回密码
 注册

微信登录

微信扫一扫,快速登录

萍聚头条

查看: 589|回复: 0

1-1-19-16 请教String、Char[]与Integer的问题

[复制链接]
发表于 2003-2-7 02:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册 微信登录

x
发信人: bloodflower (面条), 信区: Java      
标  题: Re: 请教String、Char[]与Integer的问题
发信站: BBS 水木清华站 (Tue May 28 08:39:08 2002)

是不是你自己的char[]数组构造的有问题啊?
我写了一个测试,没有问题啊。


  1. public class test
  2. {
  3.     public static void characters(char[] ch, int start, int length)
  4.     {
  5.         String propValue = new String(ch,start,length); //把字符数组转化为Stri
  6. ng
  7.      
  8.         System.out.println(propValue+"s"+start+"l"+length);
  9.         Integer intValue = new Integer(propValue);
  10.         System.out.println(intValue);
  11.     }

  12.     public static void main(String[] args)
  13.     {
  14.         char[] ch = new char[5];
  15.         String temp = "12rty";
  16.         temp.getChars(0, 5, ch, 0);
  17.         characters(ch, 0, 2);               
  18.     }
  19. }
复制代码

【 在 windwe 的大作中提到: 】
:  谢谢。
:  不过还是一样的错误。不知是不是用char[]构造的String特殊。
: 【 在 Elric (钻石恒久远,一颗永留传) 的大作中提到: 】
: :           int intValue = Integer.parseInt(propValue);
: :           我也忘的差不多了,你自己试试吧
Die von den Nutzern eingestellten Information und Meinungen sind nicht eigene Informationen und Meinungen der DOLC GmbH.
您需要登录后才可以回帖 登录 | 注册 微信登录

本版积分规则

手机版|Archiver|AGB|Impressum|Datenschutzerklärung|萍聚社区-德国热线-德国实用信息网 |网站地图

GMT+2, 2024-6-14 22:59 , Processed in 0.050778 second(s), 16 queries , MemCached On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表