Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import android.text.TextUtils;

public class Main {
    /**
     * parse value to char
     */
    public static char toChar(Object value) {
        if (value instanceof Character) {
            return (Character) value;
        }
        return value == null ? '\0' : toChar(String.valueOf(value));
    }

    /**
     * parse value to char
     */
    public static char toChar(String value) {
        return TextUtils.isEmpty(value) ? '\0' : value.charAt(0);
    }
}