Created
February 19, 2022 19:11
-
-
Save raanaYavari/3e52e71b6e459d4859a39fcb16234b3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun findPartners(key: String, arr: Array<String>): Unit { | |
var name = key.substring(0, key.lastIndexOf('_')) | |
val regex = Regex(name + "_[0-9]+") | |
arr.forEach { s -> | |
if (regex.containsMatchIn(s)) { | |
println(s) | |
} | |
} | |
} | |
fun main(args: Array<String>) { | |
val s1 = | |
"/storage/emulated/0/DCIM/MomentRecorder/Videos/MomentRecorder_2022_02_19_10_20_331_1.mp4" | |
val s2 = | |
"/storage/emulated/0/DCIM/MomentRecorder/Videos/MomentRecorder_2022_02_19_10_20_331_2.mp4" | |
val s3 = | |
"/storage/emulated/0/DCIM/MomentRecorder/Videos/MomentRecorder_2022_02_19_10_20_331_3.mp4" | |
val s4 = | |
"/storage/emulated/0/DCIM/MomentRecorder/Videos/MomentRecorder_2022_02_19_10_20_332_4.mp4" | |
findPartners(s1, arrayOf(s1, s2, s3, s4)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment