All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jtransc.io.ByteArrayExt.kt Maven / Gradle / Ivy

package com.jtransc.io

fun ByteArray.contains(other: ByteArray): Boolean = indexOf(other) >= 0

fun ByteArray.indexOf(other: ByteArray): Int {
	val full = this
	for (n in 0 until full.size - other.size) {
		if (other.indices.all { m -> full[n + m] == other[m] }) {
			return n
		}
	}
	return -1
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy