# UriCompat

# UriCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/net/UriCompat.java+class:androidx.core.net.UriCompat)  
Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/net/UriCompat "View this page in Java")

<br />

```
class UriCompat
```

<br />

*** ** * ** ***

Helper for accessing function in[Uri](https://developer.android.com/reference/android/net/Uri.html)in a backwards compatible fashion.

## Summary

|                                      ### Public functions                                       |
|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | [toSafeString](https://developer.android.com/reference/kotlin/androidx/core/net/UriCompat#toSafeString(android.net.Uri))`(uri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`)` Return a string representation of this URI that has common forms of PII redacted, making it safer to use for logging purposes. |

## Public functions

### toSafeString

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)  

```
java-static fun toSafeString(uri: Uri): String
```

Return a string representation of this URI that has common forms of PII redacted, making it safer to use for logging purposes. For example,`tel:800-466-4411`is returned as`tel:xxx-xxx-xxxx`and`http://example.com/path/to/item/`is returned as`http://example.com/...`.  

|                                 Parameters                                 |
|----------------------------------------------------------------------------|----------------------------------|
| `uri: `[Uri](https://developer.android.com/reference/android/net/Uri.html) | The uri for converted to string. |

|                                      Returns                                      |
|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | Return a string representation of this URI that has common forms of PII redacted. |