Guest User

Untitled

a guest
Jul 15th, 2018
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.28 KB | None | 0 0
  1. fun main(args: Array<String>) {
  2.     val input = """ABCDE This is some text.
  3. This is more text. ABCDE, ABCDE.
  4. ABCDE And this is [ABCDE] still more text."""
  5.    
  6.     val regex = Regex("ABCDE")
  7.     var count = 1
  8.     val result = regex.replace(input) {
  9.         _ -> "X" + count++
  10.     }
  11.     println(result)
  12. }
Advertisement
Add Comment
Please, Sign In to add comment