The extension parameter can contain multiple periods and any valid path characters, and can be any length. If extension is null, the returned string contains the contents of path with the last period and all characters following it removed. If extension is an empty string, the returned path string contains the contents of path with any characters following the last period removed. If path does not have an extension and extension is not null, the returned string contains path followed by extension. If extension is not null and does not contain a leading period, the period is added. If path contains a multiple extension separated by multiple periods, the returned string contains the contents of path with the last period and all characters following it replaced by extension.