code: public static int getFirstNonWhitespace(String strText)
      {
          if (strText != null)
          {
              for (int i = 0; i < strText.length(); i++)
              {
                  if (!Character.isWhitespace(strText.charAt(i)))
                      return i;
              }
          }
          return -1;
      }
docs: Get the position of the first non-whitespace char.
  @param strText
  @return