Java tutorial
//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; } }