relativeToOrNull

Platform and version requirements: JVM (1.5), JRE7 (1.5)
fun Path.relativeToOrNull(base: Path): Path?

Calculates the relative path for this path from a base path.

Note that the base path is treated as a directory. If this path matches the base path, then a Path with an empty path will be returned.

Return the relative path from base to this, or null if this and base paths have different roots.

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/relative-to-or-null.html