订餐网站开发流程,遵义县住房和城乡建设局网站,如何做网络营销技巧,网站上的图用美图秀秀做可以吗URI字符串解析 说明#xff1a; 本模块首批接口从API version 8开始支持。后续版本的新增接口#xff0c;采用上角标单独标记接口的起始版本。开发前请熟悉鸿蒙开发指导文档#xff1a;gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。 导入…URI字符串解析 说明 本模块首批接口从API version 8开始支持。后续版本的新增接口采用上角标单独标记接口的起始版本。开发前请熟悉鸿蒙开发指导文档gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。 导入模块
import uri from ohos.uri URI
属性
系统能力 SystemCapability.Utils.Lang
名称参数类型可读可写说明schemestring是否获取URI 的协议部分。userInfostring是否获取 URI 的用户信息部分。hoststring是否获取 URI 的主机名部分不带端口。portstring是否获取 URI 的端口部分。pathstring是否获取 URI 的路径部分。querystring是否获取 URI 的查询部分。fragmentstring是否获取 URI 的片段部分authoritystring是否获取此URI的解码权限组件部分。sspstring是否获取URI的解码方案特定部分。
constructor
constructor(uri: string)
constructor是URI的构造函数。
系统能力 SystemCapability.Utils.Lang
参数
参数名类型可读可写说明uristring是是入参对象。
示例
var mm http://username:passwordhost:8080/directory/file?foo1bar2#fragment;
new uri.URI(mm); // Output http://username:passwordhost:8080/directory/file?foo1bar2#fragment;new uri.URI(http://username:passwordhost:8080); // Output http://username:passwordhost:8080;toString
toString(): string
系统能力 SystemCapability.Utils.Lang
返回适用于URL中的查询字符串。
返回值
类型说明string返回网址的字符串序列化。
示例
const url new uri.URI(http://username:passwordhost:8080/directory/file?querypppppp#qwerda);
url.toString()equals
equals(other: URI): boolean
判断此URI是否与其他URI对象相等。
系统能力 SystemCapability.Utils.Lang
参数
参数名类型必填说明other[URI]是需要比较的URI对象。
返回值
类型说明boolean返回true表示相等否则返回false。
示例
const uriInstance new uri.URI(http://username:passwordhost:8080/directory/file?querypppppp#qwerda);
const uriInstance1 new uri.URI(http://username:passwordhost:8080/directory/file?querypppppp#qwerda#fragment);
uriInstance.equals(uriInstance1);checkIsAbsolute
checkIsAbsolute(): boolean
判断此URI是否为绝对URI是否定义了scheme组件。
系统能力 SystemCapability.Utils.Lang
返回值
类型说明boolean返回true表示该URI是否为绝对URI。
示例
const uriInstance new uri.URI(http://username:passwordwww.qwer.com:8080?querypppppp);
uriInstance.checkIsAbsolute();normalize
normalize(): URI
规范化此URI的路径。
系统能力 SystemCapability.Utils.Lang
返回值 类型说明 HarmonyOS与OpenHarmony鸿蒙文档籽料mau123789是v直接拿URI返回一个path被规范化后的URI对象。
示例
const uriInstance new uri.URI(http://username:passwordwww.qwer.com:8080/path/path1/../path2/./path3?querypppppp);
let uriInstance1 uriInstance.normalize();
uriInstance1.path;