Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Gives the first alphabet of the string if its not empty or null.
     * 
     * @param name
     * @return
     */
    public static String getFallbackTextInitials(String name) {
        if (name != null && !name.trim().isEmpty()) {
            return name.substring(0, 1);
        }
        return null;
    }
}