title: Kotlin: How do I filter a List of Strings with subSequence and do not filter out those whose length is less than subSequence requires?
body: <p>So right now I have a list of Strings like so
  <code>{a, b, c, d, Justin, Connor, BYE1, BYE2}</code></p>
  
  <p>Right now I am trying to filter out strings in the list with "BYE" in subSequence(0,3). However, if I just type that, I will get an error due to the fact there are strings in the list with less length like <code>a</code>. If I add a length checker of <code>&gt;= 3</code>, then a,b,c,d do not show up on the filtered list. How do I make it so the end filtered list is <code>{a,b,c,d,Justin,Connor}</code>? </p>
  
  <p>As for the code I am using, it is really just one line: </p>
  
  <pre><code>//currentList = {a, b, c, d, Justin, Connor, BYE1, BYE2}
  
  var filteredList: List&lt;String&gt; = currentList.filter { s -&gt; (s.length &gt;= 3 &amp;&amp; s.subSequence(0,3) != "BYE") }
  </code></pre>