icalendar.parser.string module#

Functions for manipulating strings and bytes.

icalendar.parser.string.escape_char(text)#

Format value according to iCalendar TEXT escaping rules.

Deprecated since version 7.0.0: Use the private _escape_char() internally. For external use, this function is deprecated. Please use alternative escaping methods or contact the maintainers.

Return type:

str

icalendar.parser.string.escape_string(val)#

Escape backslash sequences to URL-encoded hex values.

Deprecated since version 7.0.0: Use the private _escape_string() internally. For external use, this function is deprecated.

Return type:

str

icalendar.parser.string.foldline(line, limit=75, fold_sep='\\r\\n ')#

Make a string folded as defined in RFC5545.

Deprecated since version 7.0.0: Use the private _foldline() internally.

Return type:

str

icalendar.parser.string.unescape_char(text)#

Unescape iCalendar TEXT values.

Deprecated since version 7.0.0: Use the private _unescape_char() internally. For external use, this function is deprecated. Please use alternative unescaping methods or contact the maintainers.

Return type:

str | bytes | None

icalendar.parser.string.unescape_string(val)#

Unescape URL-encoded hex values to their original characters.

Deprecated since version 7.0.0: Use the private _unescape_string() internally. For external use, this function is deprecated.

Return type:

str

icalendar.parser.string.validate_token(name)[source]#

Validate that a name is a valid iCalendar token.

Checks if the name matches the RFC 5545 token syntax using the NAME regex pattern ([\w.-]+).

Parameters:

name (str) – The token name to validate.

Raises:

ValueError – If the name is not a valid token.

Return type:

None