Example usage for java.lang String length

List of usage examples for java.lang String length

Introduction

In this page you can find the example usage for java.lang String length.

Prototype

public int length() 

Source Link

Document

Returns the length of this string.

Usage

From source file:Main.java

public static void main(String[] argv) {
    Processor stringProcessor = (String str) -> str.length();
    String name = "Java Lambda";
    int length = stringProcessor.getStringLength(name);
    System.out.println(length);/*from  ww w.  java  2  s .com*/

}

From source file:Main.java

public static void main(String[] argv) {
    Processor stringProcessor = (final String str) -> str.length();
    String name = "Java Lambda";
    int length = stringProcessor.getStringLength(name);
    System.out.println(length);/*from   w w  w  . ja  v  a 2s.  co  m*/

}

From source file:Main.java

public static void main(String[] argv) {
    Processor stringProcessor = (String str) -> str.length();
    SecondProcessor secondProcessor = (String str) -> str.length();

    //stringProcessor = secondProcessor; //compile error
    String name = "Java Lambda";
    int length = stringProcessor.getStringLength(name);
    System.out.println(length);/* ww w.j a  v a2  s  .co m*/

}

From source file:Main.java

public static void main(String[] args) {
    String name = "Java";
    int length = name.length();

    System.out.println("Length = " + length);
}

From source file:MainClass.java

public static void main(String[] arg) {
    String s = null;

    System.out.println(s.length());
}

From source file:Main.java

public static void main(String[] argv) {
    String str = "";
    System.out.println(str.length());

    str = "demo2s.com";
    System.out.println(str.length());
}

From source file:Main.java

public static void main(String[] argv) {
    String string = "animals";
    System.out.println(string.length()); // 7 
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    byte[] bytes = new byte[] { (byte) 0x12, (byte) 0x0F, (byte) 0xF0 };

    BigInteger bi = new BigInteger(bytes);

    // Format to hexadecimal
    String s = bi.toString(16);
    if (s.length() % 2 != 0) {
        s = "0" + s;
    }/*from   w  w  w  . ja va  2  s  .  c  om*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String test = "ABCD";
    for (int i = 0; i < test.length(); ++i) {
        char c = test.charAt(i);
        int j = (int) c;
        System.out.println(j);//w w w.j a  va  2  s.  co  m
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    String test = "ABCD";
    for (int i = 0; i < test.length(); ++i) {
        char c = test.charAt(i);
        System.out.println((int) c);
    }//from  www .  j  ava 2s. c o m
}