找回密码
 注册
搜索
查看: 657|回复: 1

[讨论] 求解问题

[复制链接]
发表于 2007-9-19 10:31:11 | 显示全部楼层 |阅读模式
Properties p = new Properties();
  p.load(new FileInputStream("D:\\Myworkspace\\Test\\Demo\\ApplicationResources_ja.properties"));
  BufferedReader reader = new BufferedReader(new FileReader("D:\\Myworkspace\\Test\\Demo\\ApplicationResources_ja.properties"));
  String str = null;
  while((str=reader.readLine())!=null){
   if(str.equals("")){
    System.out.println("此行为空");
   }else{
    if(str.indexOf("=")==-1){
     System.out.println("这一行没有键值映射===>>>>>>"+str);
    }else{
     String [] arr = str.split("=");
//     System.out.println(arr[0]);
//     System.out.println(arr[1]);
     
     // 这两种输出转换方式都行不通???????为什么
//     String temp = new String(arr[1].trim().getBytes(),"GBK");
//     System.out.println(arr[0]+"="+temp);
//     arr[1] = new String(arr[1].trim().getBytes(),"GBK");
//     System.out.println(arr[1]);
     //
     
     // 下面的两种输出方式 都可以 ,都是使用的 Properties 对象加载文件
//     String temp = p.getProperty(arr[0]);
//     temp = new String(temp.trim().getBytes(),"GBK");
//     System.out.println(arr[0]+"==="+temp);
     
     arr[1] = p.getProperty(arr[0]);
     arr[1] = new String(arr[1].trim().getBytes(),"GBK");
     System.out.println(arr[0]+"==="+arr[1]);
     
     
    }
   }
  }
 楼主| 发表于 2007-9-19 11:09:15 | 显示全部楼层
怎么没有人!!!![em03]
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2025-2-24 12:01 , Processed in 0.046702 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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