stripIfNotNone

lsst.daf.butler.core.utils.stripIfNotNone(s: Optional[str]) → Optional[str]

Strip leading and trailing whitespace if the given object is not None.

Parameters:
s : str, optional

Input string.

Returns:
r : str or None

A string with leading and trailing whitespace stripped if s is not None, or None if s is None.