All Downloads are FREE. Search and download functionalities are using the official Maven repository.

poly.util.stringmatch.package.scala Maven / Gradle / Ivy

The newest version!
package poly.util

/**
 * This package enables string matching using string interpolators.
 * @author Tongfei Chen ([email protected]).
 */
package object stringmatch {

  implicit class StringMatch(ctx: StringContext) {

    /** Enables the "sm" string interpolator. */
    object sm {

      def unapplySeq(s: String): Option[List[String]] = {
        val rx = ctx.parts.mkString("(.*)")
        rx.r.unapplySeq(s)
      }

    }

  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy