title: correct way of handling StringIndexOfBoundException
body: <p>The below code throws me <code>StringIndexOfBoundException</code></p>
  
  <pre><code>if (custom.getUser().equals("0") || custom.getUser().equals("")) {
      vital.add(new Pair&lt;String, String&gt;("User", "-"));
  } else {
      vital.add(new Pair&lt;String, String&gt;("User", custom.user() + "F" + "\n" + custom.getName().subString(0,1));
  }
  </code></pre>
  
  <p>Displaying the first character of the String. The below code is working fine, but i am not sure whether its the correct way of doing it.</p>
  
  <pre><code>String name = "";
  if (custom.getUser().equals("0") || custom.getUser().equals("")) {
      vital.add(new Pair&lt;String, String&gt;("User", "-"));
  } else if (!custom.getName().equals("")) {
      name = custom.getName().substring(0, 1);
  } else {
      vital.add(new Pair&lt;String, String&gt;("User", custom.user() + "F" + "\n" + name));
  }
  </code></pre>