Skip to content

Commit

Permalink
fix: startsWithAny function uses contains (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
TakoTheDev authored Oct 6, 2024
1 parent 61ad08c commit 3258a35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/gg/skytils/skytilsmod/utils/StringUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun CharSequence?.countMatches(subString: CharSequence): Int = ApacheStringUtils
fun String?.stripControlCodes(): String = UTextComponent.stripFormatting(this ?: "")

fun CharSequence?.startsWithAny(vararg sequences: CharSequence?) = ApacheStringUtils.startsWithAny(this, *sequences)
fun CharSequence.startsWithAny(sequences: Iterable<CharSequence>): Boolean = sequences.any { contains(it) }
fun CharSequence.startsWithAny(sequences: Iterable<CharSequence>): Boolean = sequences.any { startsWith(it) }
fun CharSequence?.containsAny(vararg sequences: CharSequence?): Boolean {
if (this == null) return false
return sequences.any { it != null && this.contains(it) }
Expand Down

0 comments on commit 3258a35

Please sign in to comment.