v1.8.10
  • Solutions
    • Multiplatform
    • Server-side
    • Data science
    • Android
  • Docs
  • Community
  • Teach
  • Play
    • Playground
    • Hands-on
    • Examples
    • Koans
← Docs
kotlin-stdlib / kotlin.io.path / java.nio.file.Path / relativeToOrNull

relativeToOrNull

JVM
JRE7
1.5
fun Path.relativeToOrNull(base: Path): Path?
(source)

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.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Kotlin™ is protected under the Kotlin Foundation and licensed under the Apache 2 license.
Supported and developed by JetBrains