zoukankan      html  css  js  c++  java
  • 今天的笔记:2014年6月3日

    1. 日期的默认输出格式为:Tue Jun 03 19:30:08 CST 2014。问题:如果调整输出的格式。
      public static void fun1() {
         Date date = new Date();
         System.out.println(date.toString());
      }
    2. 使用正则表达式分割字符串。前者为错误的方法,后者为正确的方法。总结:split的参数为正则表达式,使用正则表达式时注意[ , ( 等符号,但是“\"”与“"”效果应该是一样的。
      public static void fun2() {
         String str = "0<col["age"]";
         String[] strs = str.split("col[\"");
         System.out.println(Arrays.toString(strs));
      
         for(int i = 1; i < strs.length; i++) {
            str = strs[i].split(""]")[0];
            System.out.println("Element: " + str);
         }
      }
      public static void fun2() {
         String str = "0<col["age"]";
         String[] strs = str.split("col\[\"");
         System.out.println(Arrays.toString(strs));
      
         for(int i = 1; i < strs.length; i++) {
            str = strs[i].split(""\]")[0];
            System.out.println("Element: " + str);
         }
      }
    3. 不同类型的数组在Set中,是不会默认转化的。
      public static void fun3() {
         Set<BigDecimal> set = new HashSet<BigDecimal>();
         set.add(new BigDecimal(9));
         System.out.println(set.contains(9));
         System.out.println(new BigDecimal(9) instanceof Number);
         System.out.println();
            
         Set<Byte> ints = new HashSet<Byte>();
         ints.add((byte)9);
         System.out.println(ints.contains(9));
      }

      结果为:false, true, false。
    
    
    
  • 相关阅读:
    appium 学习教程
    初识Airtest
    C语言的数据类型
    C#黑白棋制作~
    C#黑白棋制作
    C#编写自动关机程序复习的知识
    C语言的预处理命令
    构建智能DNS域名解析服务器
    NFS共享服务
    安装ftp 并在ftp上构建yum仓库 (内网构建,比如主机上不了网)
  • 原文地址:https://www.cnblogs.com/KuTeng/p/3766380.html
Copyright © 2011-2022 走看看