---
title: "init(validating:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/string/init(validating:)-6r2j9"
---

# init(validating:)

On Unix, creates the string "/"

## Declaration

```swift
init?(validating root: FilePath.Root)
```

## Parameters

- `root`: The path root to be interpreted as CInterop.PlatformUnicodeEncoding.

## Discussion

Discussion On Windows, creates a string from a path root, validating its contents as UTF-16 on Windows. On Windows, if the contents of the path root isn’t a well-formed Unicode string, this initializer returns nil.
