Strings.kt
TLDR
This file contains two internal methods for manipulating strings.
Methods
lastSegment
This method returns the last segment of a string based on a specified character. If the character is not found in the string, it returns the whole string.
createSHA1Hash
This method creates a SHA-1 hash of the string using the ByteStringCompat
class.
package shark.internal
internal fun String.lastSegment(segmentingChar: Char): String {
val separator = lastIndexOf(segmentingChar)
return if (separator == -1) this else this.substring(separator + 1)
}
internal fun String.createSHA1Hash() = ByteStringCompat.encodeUtf8(this).sha1().hex()