123456789101112131415161718192021222324 |
- package com.gxzc.zen.api
- import org.junit.Test
- import java.util.regex.Pattern
- /**
- *
- * @author NorthLan
- * @date 2018/4/29
- * @url https://noahlan.com
- */
- class TestKotlinReplace {
- @Test
- fun testKotlinReplace() {
- val url = "/user/info/{*}"
- val patternUrl = url.replace("\\{\\*}".toRegex(), "[a-zA-Z\\\\d]+")
- println("^$patternUrl\$")
- println(Pattern.compile("^$patternUrl\$").matcher("/user/info/1").find())
- println("/user/info/haha".startsWith("/user/info" + "/"))
- }
- }
|