Пример #1
0
 /**
  * Returns true if the given lazy string is a prefix of this lazy string.
  *
  * @param cs A string to find at the start of this lazy string.
  * @return True if the given string is a prefix of this lazy string, otherwise False.
  */
 public boolean startsWith(final LazyString cs) {
   return cs.isEmpty()
       || !isEmpty() && charEqual.eq(head(), cs.head()) && tail().startsWith(cs.tail());
 }
Пример #2
0
 /**
  * Returns true if the given lazy string is a suffix of this lazy string.
  *
  * @param cs A string to find at the end of this lazy string.
  * @return True if the given string is a suffix of this lazy string, otherwise False.
  */
 public boolean endsWith(final LazyString cs) {
   return reverse().startsWith(cs.reverse());
 }