Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * Search Forwards. This generalises the character version of find forwards
- *
- * The user provides a predicate to specify the search condition.
- *
- * This operation does not change any variable other than the cursor position.
- *
- */
- def sf( p: Char => Boolean ): Boolean = {
- /* def currentPos( pos: Int ): Option[Int] = {
- if ( pos >= end ) None
- else if ( p( buffer( pos ) ) ) {
- cursor = pos
- Some( pos )
- }
- else currentPos( pos + 1 )
- }
- currentPos( 0 )
- buffer.find( p ) match {
- case Some( _ ) => true
- case None => false
- }*/
- /* var b =false
- for (i <- cursor until end if !b) {
- if (p(buffer(i))) {
- cursor = i
- b = true
- }
- }
- b*/
- var c = false
- ( cursor until end ) collectFirst { case i if p( buffer( i ) ) => cursor = i; c = true }
- c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement