Java Char Create toCharacter(String input, char defaultValue)

Here you can find the source of toCharacter(String input, char defaultValue)

Description

to Character

License

Apache License

Declaration

public static char toCharacter(String input, char defaultValue) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static char toCharacter(String input, char defaultValue) {
        if (input == null) {
            return defaultValue;
        }/*from w  w w.j  av a 2s. co m*/
        if (input.length() == 1) {
            return input.charAt(0);
        } else {
            return defaultValue;
        }
    }
}

Related

  1. toCharacter(Object o)
  2. toCharacter(Object o)
  3. toCharacter(Object obj)
  4. toCharacter(Object object)
  5. toCharacter(Object value)
  6. toCharacter(String str, String charset)
  7. toCharCode(String s)
  8. toCharListNumber(int value, String list)
  9. toChars(byte b, char[] result, int position)