---
title: "init(platformString:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/string/init(platformstring:)-5j2y3"
---

# init(platformString:)

Creates a string by interpreting the null-terminated platform string as UTF-8 on Unix and UTF-16 on Windows.

## Declaration

```swift
init(platformString: UnsafePointer<CInterop.PlatformChar>)
```

## Parameters

- `platformString`: The null-terminated platform string to be interpreted as CInterop.PlatformUnicodeEncoding.

## Discussion

Discussion If the content of the platform string isn’t well-formed Unicode, this initializer replaces invalid bytes with U+FFFD. This means that, depending on the semantics of the specific platform, conversion to a string and back might result in a value that’s different from the original platform string.
