source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\reference\apis-arkts\js-apis-treeset.md | // Use the comparator firstValue < secondValue if the elements are expected to be sorted in ascending order. Use firstValue > secondValue if the elements are expected to be sorted in descending order.
let treeSet : TreeSet<string> = new TreeSet<string>((firstValue: string, secondValue: string) : boolean => {return firs... |
application-dev\reference\apis-arkts\js-apis-treeset.md | // When a custom type is inserted, a comparator must be provided.
class TestEntry{
public id: number = 0;
}
let ts1: TreeSet<TestEntry> = new TreeSet<TestEntry>((t1: TestEntry, t2: TestEntry): boolean => {return t1.id > t2.id;});
let entry1: TestEntry = {
id: 0
};
let entry2: TestEntry = {
id: 1
}
ts1.add(entry1)... |
application-dev\reference\apis-arkts\js-apis-treeset.md | const treeSet : TreeSet<string | number | boolean | Object> = new TreeSet();
let result = treeSet.isEmpty(); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<number> = new TreeSet();
treeSet.add(123);
let result = treeSet.has(123); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.getFirstValue(); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.getLastValue(); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
let result = treeSet.add("squirrel"); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.remove("sparrow"); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
treeSet.add("gander");
let result = treeSet.getLowerValue("sparrow"); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
treeSet.add("gander");
let result = treeSet.getHigherValue("sparrow"); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.popFirst(); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let result = treeSet.popLast(); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
treeSet.clear(); |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let it = treeSet.values();
let t: IteratorResult<string> = it.next();
while(!t.done) {
console.log("TreeSet: " + t.value);
t = it.next()
} |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("sparrow");
treeSet.add("gull");
treeSet.forEach((value ?: string, key ?: string) :void => {
console.log("value:" + value, "key:" + key);
}); |
application-dev\reference\apis-arkts\js-apis-treeset.md | // You are not advised to use the set or remove APIs in forEach because they may cause unpredictable risks such as infinite loops. You can use the for loop when inserting or deleting data.
let treeSet : TreeSet<string> = new TreeSet();
for(let i = 0; i < 10; i++) {
treeSet.add("sparrow" + i);
}
for(let i = 0; i < 10;... |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let it = treeSet.entries();
let t: IteratorResult<Object[]> = it.next();
while(!t.done) {
console.log("TreeSet: " + t.value);
t = it.next()
} |
application-dev\reference\apis-arkts\js-apis-treeset.md | // You are not advised to use the set or remove APIs in entries because they may cause unpredictable risks such as infinite loops. You can use the for loop when inserting or deleting data.
let treeSet : TreeSet<string> = new TreeSet();
for(let i = 0; i < 10; i++) {
treeSet.add("sparrow" + i);
}
for(let i = 0; i < 10;... |
application-dev\reference\apis-arkts\js-apis-treeset.md | let treeSet : TreeSet<string> = new TreeSet();
treeSet.add("squirrel");
treeSet.add("sparrow");
let numbers = Array.from(treeSet.values());
// Method 1:
for (let item of numbers) {
console.log("value:" + item);
}
// Method 2:
let iter = treeSet[Symbol.iterator]();
let temp: IteratorResult<string> = iter.next().value;... |
application-dev\reference\apis-arkts\js-apis-treeset.md | // You are not advised to use the set or remove APIs in Symbol.iterator because they may cause unpredictable risks such as infinite loops. You can use the for loop when inserting or deleting data.
let treeSet : TreeSet<string> = new TreeSet();
for(let i = 0; i < 10; i++) {
treeSet.add("sparrow" + i);
}
for(let i = 0;... |
application-dev\reference\apis-arkts\js-apis-uri.md | import { uri } from '@kit.ArkTS'; |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriObj1 = new uri.URI("ftp://ftp.aaa.bbb.ccc/dddd/eee.txt");
console.info(uriObj1.host); // ftp.aaa.bbb.ccc
console.info(uriObj1.fragment); // null
console.info(uriObj1.path); // /dddd/eee.txt
console.info(uriObj1.scheme); // ftp
console.info(uriObj1.userInfo); // null
console.info(uriObj1.port); // -1
console.in... |
application-dev\reference\apis-arkts\js-apis-uri.md | let mm = 'https://username:password@host:8080/directory/file?foo=1&bar=2#fragment';
new uri.URI(mm); |
application-dev\reference\apis-arkts\js-apis-uri.md | new uri.URI('https://username:password@host:8080'); |
application-dev\reference\apis-arkts\js-apis-uri.md | const result = new uri.URI('https://username:password@host:8080/directory/file?ab=pppppp#qwer da');
let result1 = result.toString(); // https://username:password@host:8080/directory/file?ab=pppppp#qwer%20da |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
let result = uriInstance.equalsTo(uriInstance1); // true |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080?query=pppppp');
console.info(`${uriInstance.checkIsAbsolute()}`); // true
const uriInstance1 = new uri.URI('xxx.com/suppliers.htm');
console.info(`${uriInstance1.checkIsAbsolute()}`); // false |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI('https://username:password@www.qwer.com:8080/path/path1/../path2/./path3?query=pppppp');
console.info(uriInstance.path); // /path/path1/../path2/./path3
// Following path normalization, all . (dot) segments are removed. If a .. (double-dot) segment is immediately preceded by a segment th... |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://username:password@www.qwer.com:8080?query=p");
console.info(`${uriInstance.checkRelative()}`); // false
const uriInstance1 = new uri.URI("/images/pic.jpg");
console.info(`${uriInstance1.checkRelative()}`); // true |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("http://www.test.com/images/pic.jpg");
console.info(`${uriInstance.checkOpaque()}`); // false
const uriInstance1 = new uri.URI("mailto:user@example.com");
console.info(`${uriInstance1.checkOpaque()}`); // true |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("http://www.test.com/images/pic.jpg");
console.info(`${uriInstance.checkHierarchical()}`); // true
const uriInstance1 = new uri.URI("mailto:user@example.com");
console.info(`${uriInstance1.checkHierarchical()}`); // false |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://www.com?param1=value1¶m2=value2");
console.info(uriInstance.getQueryValue("param1")); // value1
let uriInstance1 = new uri.URI('https://www.zyy.ss?sa%3D=po%7E');
console.info(uriInstance1.getQueryValue('sa=')) // po~
console.info(uriInstance1.getQueryValue('abc')) // null |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://www.test.com");
const newRoute = uriInstance.addQueryValue("param1", "hello world");
console.info(newRoute.toString()); // https://www.test.com?param1=hello%20world |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("http://www.test.com");
const newRoute = uriInstance.addSegment("my image.jpg");
console.info(newRoute.toString()); // http://www.test.com/my%20image.jpg |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("http://www.test.com");
const newRoute = uriInstance.addEncodedSegment("my%20image.jpg");
console.info(newRoute.toString()); // http://www.test.com/my%20image.jpg |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://www.test.com?param1=value1¶m2=value2");
const paramNames = uriInstance.getQueryNames();
console.info(Array.from(paramNames).toString()); // param1,param2 |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://www.test.com/search?query=name&query=my");
console.info(uriInstance.getQueryValues("query").toString()); // name,my
console.info(JSON.stringify(uriInstance.getQueryValues("abc"))); // [] |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://www.test.com/search?active=true");
console.info(`${uriInstance.getBooleanQueryValue("active", false)}`); // true
const uriInstance1 = new uri.URI("https://www.test.com/search");
console.info(`${uriInstance1.getBooleanQueryValue("active", false)}`); // false
const uriInstance2 = ... |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("https://www.test.com?param1=value1");
console.info(uriInstance.clearQuery().toString()); // https://www.test.com |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("content://com.test.provider/files/image.jpg");
console.info(uriInstance.getLastSegment()); // image.jpg |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI("http://www.test.com/path/to/image.jpg");
console.info(uriInstance.getSegment().toString()); // path,to,image.jpg |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = uri.URI.createFromParts("mailto", "no body", "top");
console.info(uriInstance.toString()); // mailto:no%20body#top |
application-dev\reference\apis-arkts\js-apis-uri.md | const uriInstance = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
const uriInstance1 = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
uriInstance.equals(uriInstance1); // true |
application-dev\reference\apis-arkts\js-apis-url.md | import { url } from '@kit.ArkTS'; |
application-dev\reference\apis-arkts\js-apis-url.md | // Construct a URLParams object in string[][] mode.
let objectParams = new url.URLParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
// Construct a URLParams object in Record<string, string> mode.
let objectParams1 = new url.URLParams({"fod" : '1' , "bard" : '2'});
// Construct a URLParams obje... |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLParams(urlObject.search.slice(1));
paramsObject.append('fod', '3'); |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLParams(urlObject.search.slice(1));
paramsObject.delete('fod'); |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new url.URLParams(urlObject.search.slice(1));
params.append('fod', '3'); // Add a second value for the fod parameter.
console.log(params.getAll('fod').toString()) // Output ["1","3"]. |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParamsObject = new url.URLParams("keyName1=valueName1&keyName2=valueName2");
let pair:Iterable<Object[]> = searchParamsObject.entries();
let arrayValue = Array.from(pair);
for (let pair of arrayValue) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]);
} |
application-dev\reference\apis-arkts\js-apis-url.md | const myURLObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.params.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.params === searchParams);
}); |
application-dev\reference\apis-arkts\js-apis-url.md | let paramsObject = new url.URLParams('name=Jonathan&age=18');
let name = paramsObject.get("name"); // is the string "Jonathan"
let age = paramsObject.get("age"); // is the string "18"
let getObj = paramsObject.get("abc"); // undefined |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLParams(urlObject.search.slice(1));
let result = paramsObject.has('bard'); |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLParams(urlObject.search.slice(1));
paramsObject.set('baz', '3'); // Add a third parameter. |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParamsObject = new url.URLParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=4&c=3&d=2 |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParamsObject = new url.URLParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
let keys = Array.from(searchParamsObject.keys());
for (let key of keys) { // Output key-value pairs
console.log(key);
} |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParams = new url.URLParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
let values = Array.from(searchParams.values());
for (let value of values) {
console.log(value);
} |
application-dev\reference\apis-arkts\js-apis-url.md | const paramsObject = new url.URLParams('fod=bay&edg=bap');
let iter: Iterable<Object[]> = paramsObject[Symbol.iterator]();
let pairs = Array.from(iter);
for (let pair of pairs) {
console.log(pair[0] + ', ' + pair[1]);
} |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new url.URLParams(urlObject.search.slice(1));
params.append('fod', '3');
console.log(params.toString()); // Output 'fod=1&bard=2&fod=3' |
application-dev\reference\apis-arkts\js-apis-url.md | let that = url.URL.parseURL('http://username:password@host:8080/directory/file?foo=1&bar=2#fragment');
console.log("hash " + that.hash); // hash #fragment
console.log("host " + that.host); // host host:8080
console.log("hostname " + that.hostname); // hostname host
console.log("href " + that.href); // href http://usern... |
application-dev\reference\apis-arkts\js-apis-url.md | let mm = 'https://username:password@host:8080';
let a = new url.URL("/", mm); // Output 'https://username:password@host:8080/';
let b = new url.URL(mm); // Output 'https://username:password@host:8080/';
new url.URL('path/path1', b); // Output 'https://username:password@host:8080/path/path1';
let c = new url.URL('/path/... |
application-dev\reference\apis-arkts\js-apis-url.md | let mm = 'https://username:password@host:8080/test/test1/test3';
let urlObject = url.URL.parseURL(mm);
let result = urlObject.toString(); // Output 'https://username:password@host:8080/test/test1/test3'
// If url is a relative path, the path in the base parameter is test/test1, and the path of the parsed URL is /test/p... |
application-dev\reference\apis-arkts\js-apis-url.md | const urlObject = url.URL.parseURL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
let result = urlObject.toString(); // Output 'https://username:password@host:8080/directory/file?query=pppppp#qwer=da' |
application-dev\reference\apis-arkts\js-apis-url.md | const urlObject = url.URL.parseURL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da');
let result = urlObject.toJSON(); |
application-dev\reference\apis-arkts\js-apis-url.md | let objectParams = new url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]);
let objectParams1 = new url.URLSearchParams({"fod" : '1' , "bard" : '2'});
let objectParams2 = new url.URLSearchParams('?fod=1&bard=2');
let urlObject = new url.URL('https://developer.mozilla.org/?fod=1&bard=... |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLSearchParams(urlObject.search.slice(1));
paramsObject.append('fod', '3'); |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLSearchParams(urlObject.search.slice(1));
paramsObject.delete('fod'); |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new url.URLSearchParams(urlObject.search.slice(1));
params.append('fod', '3'); // Add a second value for the fod parameter.
console.log(params.getAll('fod').toString()) // Output ["1","3"]. |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParamsObject = new url.URLSearchParams("keyName1=valueName1&keyName2=valueName2");
let iter: Iterable<Object[]> = searchParamsObject.entries();
let pairs = Array.from(iter);
for (let pair of pairs) { // Show keyName/valueName pairs
console.log(pair[0]+ ', '+ pair[1]);
} |
application-dev\reference\apis-arkts\js-apis-url.md | const myURLObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
myURLObject.searchParams.forEach((value, name, searchParams) => {
console.log(name, value, myURLObject.searchParams === searchParams);
}); |
application-dev\reference\apis-arkts\js-apis-url.md | let paramsObject = new url.URLSearchParams('name=Jonathan&age=18');
let name = paramsObject.get("name"); // is the string "Jonathan"
let age = paramsObject.get("age"); // is the string '18'
let getObj = paramsObject.get("abc"); // undefined |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLSearchParams(urlObject.search.slice(1));
paramsObject.has('bard') === true; |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let paramsObject = new url.URLSearchParams(urlObject.search.slice(1));
paramsObject.set('baz', '3'); // Add a third parameter. |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParamsObject = new url.URLSearchParams("c=3&a=9&b=4&d=2"); // Create a test URLSearchParams object
searchParamsObject.sort(); // Sort the key/value pairs
console.log(searchParamsObject.toString()); // Display the sorted query string // Output a=9&b=4&c=3&d=2 |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParamsObject = new url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
let keys = Array.from(searchParamsObject.keys());
for (let key of keys) { // Output key-value pairs
console.log(key);
} |
application-dev\reference\apis-arkts\js-apis-url.md | let searchParams = new url.URLSearchParams("key1=value1&key2=value2"); // Create a URLSearchParamsObject object for testing
let values = Array.from(searchParams.values());
for (let value of values) {
console.log(value);
} |
application-dev\reference\apis-arkts\js-apis-url.md | const paramsObject = new url.URLSearchParams('fod=bay&edg=bap');
let iter: Iterable<Object[]> = paramsObject[Symbol.iterator]();
let pairs = Array.from(iter);
for (let pair of pairs) {
console.log(pair[0] + ', ' + pair[1]);
} |
application-dev\reference\apis-arkts\js-apis-url.md | let urlObject = new url.URL('https://developer.exampleUrl/?fod=1&bard=2');
let params = new url.URLSearchParams(urlObject.search.slice(1));
params.append('fod', '3');
console.log(params.toString()); // Output 'fod=1&bard=2&fod=3' |
application-dev\reference\apis-arkts\js-apis-util.md | import { util } from '@kit.ArkTS'; |
application-dev\reference\apis-arkts\js-apis-util.md | import { util } from '@kit.ArkTS';
interface utilAddresstype {
city: string;
country: string;
}
interface utilPersontype {
name: string;
age: number;
address: utilAddresstype;
}
let name = 'John';
let age = 20;
let formattedString = util.format('My name is %s and I am %s years old', name, age);
console.info... |
application-dev\reference\apis-arkts\js-apis-util.md | let errnum = -1; // -1 is a system error code.
let result = util.errnoToString(errnum);
console.info("result = " + result);
// Output: result = operation not permitted |
application-dev\reference\apis-arkts\js-apis-util.md | async function fn() {
return 'hello world';
}
let cb = util.callbackWrapper(fn);
cb(1, (err : Object, ret : string) => {
if (err) throw new Error;
console.info(ret);
});
// Output: hello world |
application-dev\reference\apis-arkts\js-apis-util.md | async function fn() {
return 'hello world';
}
const addCall = util.promisify(util.callbackWrapper(fn));
(async () => {
try {
let res: string = await addCall();
console.info(res);
// Output: hello world
} catch (err) {
console.info(err);
}
})(); |
application-dev\reference\apis-arkts\js-apis-util.md | let uuid = util.generateRandomUUID(true);
console.info("RFC 4122 Version 4 UUID:" + uuid);
// Output a random UUID. |
application-dev\reference\apis-arkts\js-apis-util.md | let uuid = util.generateRandomBinaryUUID(true);
console.info(JSON.stringify(uuid));
// Output a random UUID. |
application-dev\reference\apis-arkts\js-apis-util.md | let uuid = util.parseUUID("84bdf796-66cc-4655-9b89-d6218d100f9c");
console.info("uuid = " + uuid);
// Output: uuid = 132,189,247,150,102,204,70,85,155,137,214,33,141,16,15,156 |
application-dev\reference\apis-arkts\js-apis-util.md | let res = util.printf("%s", "hello world!");
console.info(res);
// Output: hello world! |
application-dev\reference\apis-arkts\js-apis-util.md | let errnum = -1; // -1 is a system error code.
let result = util.getErrorString(errnum);
console.info("result = " + result);
// Output: result = operation not permitted |
application-dev\reference\apis-arkts\js-apis-util.md | interface Person {
name: string,
age: number
}
let obj: Person = { name: 'Jack', age: 20 };
let result1 = util.getHash(obj);
console.info('result1 is ' + result1);
let result2 = util.getHash(obj);
console.info('result2 is ' + result2);
// Output: The values of result1 and result2 are the same and are a random hash ... |
application-dev\reference\apis-arkts\js-apis-util.md | let stack = util.getMainThreadStackTrace();
console.info(stack);
// Obtain the stack trace information of the main thread. |
application-dev\reference\apis-arkts\js-apis-util.md | class MyClass {
msg: string = 'msg000';
foo(arg: string): string {
console.info('foo arg is ' + arg);
return this.msg;
}
static data: string = 'data000';
static bar(arg: string): string {
console.info('bar arg is ' + arg);
return MyClass.data;
}
}
let asp = new MyClass();
let result = asp.foo... |
application-dev\reference\apis-arkts\js-apis-util.md | class MyClass {
msg: string = 'msg000';
foo(arg: string): string {
console.info('foo arg is ' + arg);
return this.msg;
}
}
let asp = new MyClass();
let result = asp.foo('123');
// Output: foo arg is 123
console.info('result is ' + result);
// Output: result is msg000
console.info('asp.msg is ' + asp.msg)... |
application-dev\reference\apis-arkts\js-apis-util.md | class MyClass {
msg: string = 'msg000';
foo(arg: string): string {
console.info('foo arg is ' + arg);
return this.msg;
}
}
let asp = new MyClass();
let result = asp.foo('123');
// Output: foo arg is 123
console.info('result is ' + result);
// Output: result is msg000
console.info('asp.msg is ' + asp.msg)... |
application-dev\reference\apis-arkts\js-apis-util.md | let textDecoder = new util.TextDecoder();
let retStr = textDecoder.encoding;
console.info('retStr = ' + retStr);
// Output: retStr = utf-8 |
application-dev\reference\apis-arkts\js-apis-util.md | let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM : true
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions);
let retStr = textDecoder.encoding;
console.info('retStr = ' + retStr);
// Output: retStr = utf-8 |
application-dev\reference\apis-arkts\js-apis-util.md | let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM : true
}
let decodeToStringOptions: util.DecodeToStringOptions = {
stream: false
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions);
let uint8 = new Uint8Array([0xEF, 0xBB, 0xBF, 0x61, 0x62, 0x63]);
let retStr = text... |
application-dev\reference\apis-arkts\js-apis-util.md | let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM : true
}
let decodeWithStreamOptions: util.DecodeWithStreamOptions = {
stream: false
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions);
let uint8 = new Uint8Array(6);
uint8[0] = 0xEF;
uint8[1] = 0xBB;
uint8[2] = 0xB... |
application-dev\reference\apis-arkts\js-apis-util.md | let textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true}); |
application-dev\reference\apis-arkts\js-apis-util.md | let textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
let uint8 = new Uint8Array(6);
uint8[0] = 0xEF;
uint8[1] = 0xBB;
uint8[2] = 0xBF;
uint8[3] = 0x61;
uint8[4] = 0x62;
uint8[5] = 0x63;
console.info("input num:");
let retStr = textDecoder.decode(uint8, {stream: false});
console.info("retStr = " + retStr);... |
application-dev\reference\apis-arkts\js-apis-util.md | let textEncoder = new util.TextEncoder(); |
application-dev\reference\apis-arkts\js-apis-util.md | let textEncoder = new util.TextEncoder("utf-8"); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.