---
title: "readLine(strippingNewline:)"
framework: swift
role: symbol
role_heading: Function
path: "swift/readline(strippingnewline:)"
---

# readLine(strippingNewline:)

Returns a string read from standard input through the end of the current line or until EOF is reached.

## Declaration

```swift
func readLine(strippingNewline: Bool = true) -> String?
```

## Parameters

- `strippingNewline`: If true, newline characters and character combinations are stripped from the result; otherwise, newline characters or character combinations are preserved. The default is true.

## Return Value

Return Value The string of characters read from standard input. If EOF has already been reached when readLine() is called, the result is nil.

## Discussion

Discussion Standard input is interpreted as UTF-8. Invalid bytes are replaced by Unicode replacement characters.

## See Also

### Command Line Input

- [CommandLine](swift/commandline.md)
