zoukankan      html  css  js  c++  java
  • Java String

     to convert a string, or a portion of a string, into an array of characters

    palindrome.getChars(0, len, tempCharArray, 0);

    Creating Format Strings

    You have seen the use of the printf() and format() methods to print output with formatted numbers. The String class has an equivalent class method, format(), that returns a String object rather than a PrintStream object.

    Using String's static format() method allows you to create a formatted string that you can reuse, as opposed to a one-time print statement. For example, instead of

    System.out.printf("The value of the float " +
                      "variable is %f, while " +
                      "the value of the " + 
                      "integer variable is %d, " +
                      "and the string is %s", 
                      floatVar, intVar, stringVar); 
    

    you can write

    String fs;
    fs = String.format("The value of the float " +
                       "variable is %f, while " +
                       "the value of the " + 
                       "integer variable is %d, " +
                       " and the string is %s",
                       floatVar, intVar, stringVar);
    System.out.println(fs);
    
  • 相关阅读:
    flash
    Python
    ArchLinux2012.12后续软件安装
    archlinux win7+ubuntu双系统引导问题
    转盘项目
    Archlinux121210+kde4.95声音输出解决
    作为程序员为什么一直都很努力,却没有进步?
    打造属于自己的谷歌地图版博客公告【演示+源码】
    人类已经不能阻止开源了Web 2.0开源应用大汇总
    LAMP网站架构方案分析【精辟转】
  • 原文地址:https://www.cnblogs.com/morningdew/p/5700643.html
Copyright © 2011-2022 走看看