Skip to main content
Version: 0.3.x

is_end_line_break

FunctionPrivateSource

flag: bool = syncstream.base.is_end_line_break(val_str: str)

A function used for checking whether the str ends with a line break.

The checking is implemented by

https://docs.python.org/3/library/stdtypes.html#str.splitlines

We use this function to fix the missing final line break problem of str.splitlines.

Arguments

Requires

ArgumentTypeRequired
Description
val_strstrThe string that needs to be validated.

Returns

ArgumentType
Description
flagboolIf True, the validated string ends with a line break.

Example

Check the line break

check_line_break.py
from syncstream.base import is_end_line_break

print(is_end_line_break('no break'))
print(is_end_line_break('middle\n break'))
print(is_end_line_break('ends break\n'))
print(is_end_line_break('ends break mac\r'))