/** * 请求工具所使用的工具函数 * * 功能介绍: * 提供了一些处理工具函数,方便使用。 * * Author: imengyu * Date: 2022/03/25 * * Copyright (c) 2021 imengyu.top. Licensed under the MIT License. * See License.txt in the project root for license information. */ /* eslint-disable no-bitwise */ /** * 移除URL的地址部分,只保留路径 * @param str 原URL * @returns */ export function removeUrlOrigin(str: string) : string { if(str.startsWith('http://') || str.startsWith('https://') || str.startsWith('fts://') || str.startsWith('ftps://')) { str = str.substr(str.indexOf('://') + 3); str = str.substr(str.indexOf('/') + 1); } return str; }