Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
import java.util.regex.Pattern.quote
|
||||
def strip1(x: String, s: String = "/*", e: String = "*/") =
|
||||
x.replaceAll("(?s)"+quote(s)+".*?"+quote(e), "")
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
def strip2(x: String, s: String = "/*", e: String = "*/"): String = {
|
||||
val a = x indexOf s
|
||||
val b = x indexOf (e, a + s.length)
|
||||
if (a == -1 || b == -1) x
|
||||
else strip2(x.take(a) + x.drop(b + e.length), s, e)
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
def strip3(x: String, s: String = "/*", e: String = "*/"): String = x.indexOf(s) match {
|
||||
case -1 => x
|
||||
case i => x.indexOf(e, i + s.length) match {
|
||||
case -1 => x
|
||||
case j => strip2(x.take(i) + x.drop(j + e.length), s, e)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue