title: JAVA :How to determine the index of the next character in a string NOT equal to a set of delimiters
body: <p>I don't think this question is very complicated to an experienced programmer, but I'm pretty new to it so I'm struggling.
  I have a list of delimiters declared before a java class as such:</p>
  
  <pre><code>public static final String DELIMITERS = ",&lt;.&gt;/?;:'\"[{]}\\|=+-_)(*&amp;^%$#@!`~ \t\n";
  </code></pre>
  
  <p>I'd like to create a method that takes two parameters (a starting index and a string). The goal is to read through the string and return the next index that corresponds to a character NOT in the list of delimiters given above. If the starting index is a negative number or greater than the length of the text, the method should simply return -1. Otherwise it just returns the index of the next character NOT in the delimiter list.
  This is what I have so far:</p>
  
  <pre><code>public static boolean isDelimiter(char c) {
      String letter = "" + c;
      if(DELIMITERS.contains(letter)){
          return true;
      }
      else{
          return false;
      }
  }
  
  public static int posNextWord(int startPosition, String text) {
      boolean isWord = false;
      int nextWordPosition = 0;
      if(startPosition &lt; 0 || startPosition &gt; (text.length()-1)){
          return -1;
      }
      else{
          while(isWord = false) {
              for (int i = startPosition; i &lt; text.length(); i++) {
                  if(!isDelimiter(text.charAt(i))){
                      nextWordPosition = nextWordPosition + i + startPosition;
                      isWord = true;
                  }
                  else{
                      isWord = false;
                  }
              }
          }
          return nextWordPosition;
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>When I run this program with a sample text and index, however, the method just returns the number 0. Any help at all would be much appreciated. Also, the method isDelimiter is required for use in the posNextWord() method.</p>