code: public static CharSequence take(CharSequence self, int num) {
          if (num < 0) {
              return self.subSequence(0, 0);
          }
          if (self.length() <= num) {
              return self;
          }
          return self.subSequence(0, num);
      }
docs: Returns the first <code>num</code> elements from this CharSequence.
  <pre class="groovyTestCase">
  def text = "Groovy"
  assert text.take( 0 ) == ''
  assert text.take( 2 ) == 'Gr'
  assert text.take( 7 ) == 'Groovy'
  </pre>
  
  @param self the original CharSequence
  @param num  the number of chars to take from this CharSequence
  @return a CharSequence consisting of the first <code>num</code> chars,
  or else the whole CharSequence if it has less then <code>num</code> elements.
  @since 1.8.1