自適性運算式預建函式Adaptive expressions prebuilt functions

適用于: SDK v4APPLIES TO: SDK v4

此文章列出依其一般用途排序的可用預建函式。This article lists the available prebuilt functions ordered by their general purpose. 如需預建函數和運算式語法中使用之運算子的詳細資訊,請參閱 運算子For information about operators used in prebuilt functions and expression syntax, see Operators.

預建運算式會分成下列函式類型:Prebuilt expressions are divided into the following function types:

您也可以依字母順序檢視清單。You can also view the list in alphabetical order.

字串函數String functions

函式Function 說明Explanation
lengthlength 傳回字串的長度。Return the length of a string.
replacereplace 使用指定字串取代子字串,並傳回已更新的字串。Replace a substring with the specified string and return the updated string. 此函式會區分大小寫。This function is case-sensitive.
replaceIgnoreCasereplaceIgnoreCase 使用指定字串取代子字串,並傳回已更新的字串。Replace a substring with the specified string, and return the updated string. 此函式區分大小寫。This function is case-insensitive.
分割split 根據指定的分隔符號,傳回包含子字串的陣列。Return an array that contains substrings based on the delimiter specified.
substringsubstring 傳回字串中的字元。Return characters from a string.
toLowertoLower 以選擇性的地區設定格式傳回小寫的字串。Return a string in lowercase in an optional locale format.
toUppertoUpper 以選擇性的地區設定格式傳回大寫的字串。Return a string in uppercase in an optional locale format.
修剪trim 從字串移除開頭與結尾的空白字元。Remove leading and trailing white spaces from a string.
addOrdinaladdOrdinal 傳回輸入數字的序數。Return the ordinal number of the input number.
endsWithendsWith 檢查字串是否以特定的子字串結束。Check whether a string ends with a specific substring. 如果找到子字串,則傳回 true;如果找不到,則傳回 falseReturn true if the substring is found, or return false if not found. 此函式區分大小寫。This function is case-insensitive.
startsWithstartsWith 檢查字串是否以特定的子字串開始。Check whether a string starts with a specific substring. 如果找到子字串,則傳回 true;如果找不到,則傳回 falseReturn true if the substring is found, or return false if not found. 此函式區分大小寫。This function is case-insensitive.
countWordcountWord 傳回指定字串中的單字數。Return the number of words in the given string.
concatconcat 結合兩個或多個字串,並傳回產生的字串。Combine two or more strings and return the resulting string.
newGuidnewGuid 傳回新的 Guid 字串。Return a new Guid string.
indexOfindexOf 傳回子字串的起始位置或索引值, 搜尋指定物件並傳回整個清單中第一次出現的零基索引。Return the starting position or index value of a substring or searches for the specified object and return the zero-based index of the first occurrence within the entire list. 此函式區分大小寫,而且索引從數字 0 開始。This function is case-insensitive, and indexes start with the number 0.
lastIndexOflastIndexOf 傳回子字串最後一次出現的起始位置或索引值, 搜尋指定物件並傳回清單中元素範圍內最後一次出現的零基索引。此函式不區分大小寫,索引從數字 0 開始。Return the starting position or index value of the last occurrence of a substring or search for the specified object and return the zero-based index of the last occurrence within the range of elements in the list.This function is case-insensitive, and indexes start with the number 0.
sentenceCasesentenceCase 以選擇性的本機格式,將字串中第一個單字的第一個字母大寫。Capitalize the first letter of the first word in a string in an optional local format.
首碼大寫titleCase 將字串中每個單字的第一個字母以選擇性的地區設定格式大寫。Capitalize the first letter of each word in a string in an optional locale format.

集合函式Collection functions

函式Function 說明Explanation
containscontains 適用於尋找字串中的項目、尋找陣列中的項目,或尋找複雜物件中的參數。Works to find an item in a string, to find an item in an array, or to find a parameter in a complex object.
範例Examples:
contains('hello world', 'hello')contains('hello world', 'hello')
contains(createArray('1','2'), '1')contains(createArray('1','2'), '1')
contains(json("{'foo':'bar'}"), 'foo')contains(json("{'foo':'bar'}"), 'foo')
firstfirst 傳回集合中的第一個項目。Return the first item from the collection.
joinjoin 傳回具有陣列中所有項目,並以分隔符號將每個字元隔開的字串。Return a string that has all the items from an array and has each character separated by a delimiter.
範例Example:
join(createArray('a','b'), '.') = "a.b"join(createArray('a','b'), '.') = "a.b"
lastlast 傳回集合中的最後一個項目。Return the last item from the collection.
計數count 傳回集合中的項目數。Return the number of items in the collection.
foreachforeach 在每個元素上操作,並傳回新的集合。Operate on each element and return the new collection.
unionunion 傳回具有指定集合中所有項目的集合。Return a collection that has all the items from the specified collections.
skipskip 移除集合前端的項目,並傳回剩餘的項目。Remove items from the front of a collection, and return the remaining items.
taketake 傳回集合中的前端項目。Return items from the front of a collection.
intersectionintersection 在指定的多個集合中,傳回只有共同項目的集合。Return a collection that has only the common items across the specified collections.
subArraysubArray 從指定的開始與結束位置傳回子陣列。Return a subarray from specified start and end position. 索引值會以數字 0 開頭。Index values start with the number 0.
selectselect 在每個元素上操作,並傳回已轉換元素的新集合。Operate on each element and return the new collection of transformed elements.
wherewhere 篩選每個元素,並傳回符合特定條件之已篩選元素的新集合。Filter on each element and return the new collection of filtered elements which match the specific condition.
sortBysortBy 以遞增順序排序集合中的元素,並傳回已排序的集合。Sort elements in the collection in ascending order and return the sorted collection.
sortByDescendingsortByDescending 以遞減順序排序集合中的元素,並傳回已排序的集合。Sort elements in the collection in descending order and return the sorted collection.
indicesAndValuesindicesAndValues 使用 index 與 value 屬性,將陣列或物件轉換為物件的陣列。Turn an array or object into an array of objects with index and value property.
flattenflatten 將陣列壓平合併為具有非陣列值的陣列。Flatten arrays into an array with non-array values.
uniqueunique 從陣列中移除所有重複項。Remove all duplicates from an array.

邏輯比較函式Logical comparison functions

函式Function 說明Explanation
andand 邏輯 AND。Logical and. 如果所有指定的運算式都評估為 True,則傳回 True。Return true if all specified expressions evaluate to true.
equalsequals 比較「等於」。Comparison equal. 如果指定的值相等,則傳回 True。Return true if specified values are equal.
emptyempty 檢查目標是否空白。Check if the target is empty.
greatergreater 比較「大於」。Comparison greater than. 如果第一個值較大,則傳回 true;如果較小,則傳回 falseReturn true if the first value is more, or return false if less.
greaterOrEqualsgreaterOrEquals 比較「大於或等於」。Comparison greater than or equal to. 如果第一個值大於或等於,則傳回 true;如果第一個值較小,則傳回 falseReturn true if the first value is greater or equal, or return false if the first value is less.
ifif 檢查運算式是 True 或 False。Check whether an expression is true or false. 根據結果,傳回指定的值。Based on the result, return a specified value.
lessless 比較「小於」運算。Comparison less than opearation. 如果第一個值較小,則傳回 true;如果較大,則傳回 falseReturn true if the first value is less, or return false if the first value is more.
lessOrEqualslessOrEquals 比較「小於或等於」運算。Comparison less than or equal operation. 如果第一個值較小或相等,則傳回 true;如果較大,則傳回 falseReturn true if the first value is less than or equal, or return false if the first value is more.
notnot 邏輯 NOT 運算子。Logical not opearator. 如果運算式為 False,則傳回 true;如果為 True,則傳回 falseReturn true if the expression is false, or return false if true.
oror 邏輯 OR 運算。Logical or opearation. 如果至少有一個運算式為 True,則傳回 true;如果全部為 False,則傳回 falseReturn true if at least one expression is true, or return false if all are false.
existsexists 評估運算式的真實性。Evaluate an expression for truthiness.

轉換函數Conversion functions

函式Function 說明Explanation
floatfloat 傳回指定字串的浮點數表示。Return the floating point representation of the specified string.
intint 傳回指定字串的整數表示。Return the integer representation of the specified string.
stringstring 以選擇性的地區設定格式傳回指定值的字串版本。Return the string version of the specified value in an optional locale format.
boolbool 傳回指定字串的布林值表示法。Return the Boolean representation of the specified string.
createArraycreateArray 從多個輸入建立陣列。Create an array from multiple inputs.
jsonjson 傳回字串或 XML 的 JavaScript 物件標記法 (JSON) 類型值或物件。Return the JavaScript Object Notation (JSON) type value or object of a string or XML.
base64base64 傳回字串或位元組陣列的 Base64 編碼版本。Return the base64-encoded version of a string or byte array.
base64ToBinarybase64ToBinary 傳回 base64 編碼字串的二進位版本。Return the binary version for a base64-encoded string.
base64ToStringbase64ToString 傳回 Base64 編碼字串的字串版本。Return the string version of a base64-encoded string.
binarybinary 傳回輸入值的二進位版本。Return the binary version for an input value.
dataUridataUri 傳回輸入值的 URI。Return the URI for an input value.
dataUriToBinarydataUriToBinary 傳回資料 URI 的二進位版本。Return the binary version of a data URI.
dataUriToStringdataUriToString 傳回資料 URI 的字串版本。Return the string version of a data URI.
uriComponenturiComponent 藉由以逸出字元取代 URL 中的 Unsafe 字元,傳回輸入值的 URI 編碼版本。Return the URI-encoded version for an input value by replacing URL-unsafe characters with escape characters.
uriComponentToStringuriComponentToString 傳回 URI 編碼字串的字串版本。Return the string version of a URI-encoded string.
xmlxml 僅限 C#。C# only. 傳回字串的 XML 版本。Return the XML version of a string.
formatNumberformatNumber 將值格式化為最接近指定的小數位數和選擇性的指定地區設定。Format a value to the nearest number to the specified number of fractional digits and an optional specified locale.

數學函數Math functions

函式Function 說明Explanation
新增add 數學 AND。Mathematical and. 傳回加總兩個數字 (純數字的情況) 或串連兩或多個字串的結果。Return the result from adding two numbers (pure number case) or concatting two or more strings.
divdiv 數學除法。Mathematical division. 傳回兩數相除的整數結果。Return the integer result from dividing two numbers.
maxmax 傳回集合中的最大值。Return the largest value from a collection.
minmin 傳回集合中的最小值。Return the smallest value from a collection.
modmod 傳回兩數相除的餘數。Return the remainder from dividing two numbers.
mulmul 數學乘法。Mathematical multiplication. 傳回將兩數相乘的乘積。Return the product from multiplying two numbers.
randrand 傳回指定的最小值與最大值之間的亂數。Return a random number between specified min and max value.
subsub 數學減法。Mathematical subtraction. 傳回第一個數字減去第二個數字的結果。Return the result from subtracting the second number from the first number.
sumsum 傳回陣列中數字的總和。Return the sum of numbers in an array.
rangerange 傳回從指定整數開始的整數陣列。Return an integer array that starts from a specified integer.
expexp 傳回兩數的乘冪。Return exponentiation of one number to another.
averageaverage 傳回數值陣列的平均值。Return the average number of an numeric array.
地板floor 傳回小於或等於指定數位的最大整數值。Return the largest integral value less than or equal to the specified number.
天花板ceiling 傳回大於或等於指定數位的最小整數值。Return the smallest integral value greater than or equal to the specified number.
round 將值四捨五入到最接近的整數或指定的小數位數。Round a value to the nearest integer or to the specified number of fractional digits.

日期和時間函式Date and time functions

函式Function 說明Explanation
addDaysaddDays 以選擇性的地區設定格式,將指定的天數加到指定的時間戳記。Add a number of specified days to a given timestamp in an optional locale format.
addHoursaddHours 以選擇性的地區設定格式,將指定的小時數新增至指定的時間戳記。Add a specified number of hours to a given timestamp in an optional locale format.
addMinutesaddMinutes 以選擇性的地區設定格式,將指定的分鐘數新增至指定的時間戳記。Add a specified number of minutes to a given timestamp in an optional locale format.
addSecondsaddSeconds 在指定的時間戳記中加上指定的秒數。Add a specified number of seconds to a given timestamp.
dayOfMonthdayOfMonth 傳回指定時間戳記或 Timex 運算式的月份日期。Return the day of a month for a given timestamp or Timex expression.
dayOfWeekdayOfWeek 傳回指定時間戳記的星期幾。Return the day of the week for a given timestamp.
dayOfYeardayOfYear 傳回指定時間戳記的年份日期。Return the day of the year for a given timestamp.
formatDateTimeformatDateTime 傳回選用地區設定格式的時間戳記。Return a timestamp in an optional locale format.
formatEpochformatEpoch 從 UNIX Epoch time (Unix 時間、POSIX 時間) ,傳回選用地區設定格式的時間戳記。Return a timestamp in an optional locale format from UNIX Epoch time (Unix time, POSIX time).
formatTicksformatTicks 從刻度傳回選用地區設定格式的時間戳記。Return a timestamp in an optional locale format from ticks.
subtractFromTimesubtractFromTime 使用選擇性的地區設定格式,從時間戳記減去時間單位數。Subtract a number of time units from a timestamp in an optional locale format.
utcNowutcNow 以字串形式傳回選用地區設定格式的目前時間戳記。Return the current timestamp in an optional locale format as a string.
dateReadBackdateReadBack 使用 date-time 程式庫提供日期回讀。Use the date-time library to provide a date readback.
monthmonth 傳回指定時間戳記的月份。Return the month of given timestamp.
datedate 傳回指定時間戳記的日期。Return the date for a given timestamp.
yearyear 傳回指定時間戳記的年份。Return the year for the given timestamp.
getTimeOfDaygetTimeOfDay 傳回指定時間戳記的當日時間。Return the time of day for a given timestamp.
getFutureTimegetFutureTime 以選擇性的地區設定格式以及指定的時間單位傳回目前的時間戳記。Return the current timestamp in an optional locale format plus the specified time units.
getPastTimegetPastTime 以選用的地區設定格式傳回目前的時間戳記減去指定的時間單位。Return the current timestamp in an optional locale format minus the specified time units.
addToTimeaddToTime 以選擇性的地區設定格式,將數個時間單位新增至時間戳記。Add a number of time units to a timestamp in an optional locale format.
convertFromUTCconvertFromUTC 從國際標準時間協調 (UTC) 轉換選用地區設定格式的時間戳記。Convert a timestamp in an optional locale format from Universal Time Coordinated (UTC).
convertToUTCconvertToUTC 將選用地區設定格式的時間戳記轉換為國際標準時間協調 (UTC) 。Convert a timestamp in an optional locale format to Universal Time Coordinated (UTC).
startOfDaystartOfDay 以選擇性的地區設定格式傳回時間戳記的一天開始。Return the start of the day for a timestamp in an optional locale format.
startOfHourstartOfHour 以選擇性的地區設定格式傳回時間戳記的小時開始。Return the start of the hour for a timestamp in an optional locale format.
startOfMonthstartOfMonth 以選擇性的地區設定格式傳回時間戳記的月首。Return the start of the month for a timestamp in an optional locale format.
ticksticks 傳回指定時間戳記的刻度屬性值。Return the ticks property value of a specified timestamp.
ticksToDaysticksToDays 將刻度屬性值轉換為天數。Convert a ticks property value to the number of days.
ticksToHoursticksToHours 將刻度屬性值轉換為時數。Convert a ticks property value to the number of hours.
ticksToMinutesticksToMinutes 將刻度屬性值轉換為分鐘數。Convert a ticks property value to the number of minutes.
dateTimeDiffdateTimeDiff 傳回兩個時間戳記之間的刻度差異。Return the difference in ticks between two timestamps.
getPreviousViableDategetPreviousViableDate 根據目前日期和選擇性指定的時區,傳回 timex 運算式先前的可行日期。Return the previous viable date of a timex expression based on the current date and an optionally specified timezone.
getNextViableDategetNextViableDate 根據目前日期和選擇性指定的時區,傳回 timex 運算式的下一個可行日期。Return the next viable date of a timex expression based on the current date and an optionally specified timezone.
getPreviousViableTimegetPreviousViableTime 根據目前時間和選擇性指定的時區,傳回 timex 運算式的先前可用時間。Return the previous viable time of a timex expression based on the current time and an optionally specified timezone.
getNextViableTimegetNextViableTime 根據目前時間和選擇性指定的時區,傳回 timex 運算式的下一個可用時間。Return the next viable time of a timex expression based on the current time and an optionally specified timezone.

Timex 函式Timex functions

函式Function 說明Explanation
isPresentisPresent 如果 TimexProperty 或 Timex 運算式參考現在,則傳回 True。Return true if the TimexProperty or Timex expression refers to the present.
isDurationisDuration 如果 TimexProperty 或 Timex 運算式參考持續時間,則傳回 True。Return true if the TimexProperty or Timex expression refers to a duration.
isTimeisTime 如果 TimexProperty 或 Timex 運算式參考時間,則傳回 True。Return true if the TimexProperty or Timex expression refers to a time.
isDateisDate 如果 TimexProperty 或 Timex 運算式參考日期,則傳回 True。Return true if the TimexProperty or Timex expression refers to a date.
isTimeRangeisTimeRange 如果 TimexProperty 或 Timex 運算式參考時間範圍,則傳回 True。Return true if the TimexProperty or Timex expression refers to a time range.
isDateRangeisDateRange 如果 TimexProperty 或 Timex 運算式參考日期範圍,則傳回 True。Return true if the TimexProperty or Timex expression refers to a date range.
isDefiniteisDefinite 如果 TimexProperty 或 Timex 運算式參考明確的日期,則傳回 True。Return true if the TimexProperty or Timex expression refers to a definite day.

URI 剖析函式URI parsing functions

函式Function 說明Explanation
uriHosturiHost 傳回統一資源識別項 (URI) 的主機值。Return the host value of a uniform resource identifier (URI).
uriPathuriPath 傳回統一資源識別項 (URI) 的路徑值。Return the path value of a unifor resource identifier (URI).
uriPathAndQueryuriPathAndQuery 傳回統一資源識別項 (URI) 的路徑與查詢值。Return the path and query values for a uniform resource identifier (URI).
uriPorturiPort 傳回統一資源識別項 (URI) 的連接埠值。Return the port value of a uniform resource identifier (URI).
uriQueryuriQuery 傳回統一資源識別項 (URI) 的查詢值。Retur0sn the query value of a uniform resouce identifier (URI).
uriSchemeuriScheme 傳回統一資源識別項 (URI) 的配置值。Return the scheme value of a uniform resource identifier (URI).

物件操作與建構函式Object manipulation and construction functions

函式Function 說明Explanation
addPropertyaddProperty 將屬性與其值或成對的名稱和數值新增至 JSON 物件,並傳回更新的物件。Add a property and its value, or name-value pair, to a JSON object and return the updated object.
removePropertyremoveProperty 從 JSON 物件中移除屬性,並傳回更新的物件。Remove a property from JSON object and return the updated object.
setPropertysetProperty 設定 JSON 物件屬性的值,並傳回更新的物件。Set the value of a JSON object's property and return the updated object.
getPropertygetProperty 從 JSON 物件傳回指定之屬性或根屬性的值。Return the value of a specified property or root property from a JSON object.
coalescecoalesce 從一個或多個參數中傳回第一個非 Null 值。Return the first non-null value from one or more parameters.
xPathxPath 僅限 C#。C# only. 檢查 XML 中是否有符合 XPath (XML 路徑語言) 運算式的節點或值,並傳回符合的節點或值。Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values.
jPathjPath 檢查 JSON 或 JSON 字串中是否有符合路徑運算式的節點或值,並傳回相符的節點。Check JSON or a JSON string for nodes or value that match a path expression, and return the matching nodes.
setPathToValuesetPathToValue 設定特定路徑的值,並傳回值。Set the value of a specific path and return the value.

規則運算式函式Regular expression functions

函式Function 說明Explanation
isMatchisMatch 如果字串符合一般 RegEx 模式,則傳回 True。Return true if a string matches a common regex pattern.

類型檢查函數Type checking functions

函式Function 說明Explanation
EolEOL 僅限 C#。C# only. 傳回 (EOL) 序列文字的行尾。Return the end of line (EOL) sequence text.
isIntegerisInteger 如果指定的輸入為整數,則傳回 TrueReturn true if given input is an integer number
isFloatisFloat 如果指定的輸入為浮點數,則傳回 TrueReturn true if the given input is a float point number
isBooleanisBoolean 如果指定的輸入為布林值,則傳回 True。Return true if the given input is a Boolean.
isArrayisArray 如果指定的輸入為陣列,則傳回 True。Return true if the given input is an array.
isObjectisObject 如果指定的輸入為物件,則傳回 True。Return true if the given input is an object.
isDateTimeisDateTime 如果指定的輸入為 UTC ISO 格式時間戳記,則傳回 True。Return true if the given input is a UTC ISO format timestamp.
isStringisString 如果指定的輸入為字串,則傳回 True。Return true if the given input is a string.

預建函數依字母順序排序Prebuilt functions sorted alphabetically

addadd

傳回加總兩或多個數字 (純數字的情況) 或串連兩或多個字串的結果 (其他情況)。Return the result from adding two or more numbers (pure number case) or concatting two or more strings (other case).

add(<item1>, <item2>, ...)
參數Parameter 必要Required 類型Type 描述Description
<item1>, <item2>,...<item1>, <item2>,... Yes 任意any 項目items
傳回值Return value 類型Type 描述Description
<result-sum><result-sum> 數字或字串number or string 來自加總指定數字的結果或串連結果。The result from adding the specified numbers or the concat result.

範例Example

此範例會相加指定的數字:This example adds the specified numbers:

add(1, 1.5)

並傳回結果 2.5And returns the result 2.5.

此範例會串連指定的項目:This example concats the specified items:

add('hello',null)
add('hello','world')

並傳回結果And returns the results

  • hellohello
  • helloworldhelloworld

addDaysaddDays

以選擇性的地區設定格式,將天數加上時間戳記。Add a number of days to a timestamp in an optional locale format.

addDays('<timestamp>', <days>, '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串,其必須是標準的 UTC ISO 格式The string that contains the timestamp which must be standard UTC ISO format
YYYY-MM-DDTHH:mm:ss.fffZYYYY-MM-DDTHH:mm:ss.fffZ
<days><days> Yes integerinteger 要加入的天數 (正數或負數)The positive or negative number of days to add
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 時間戳記加上指定的天數The timestamp plus the specified number of days

範例 1Example 1

此範例會在指定的時間戳記中加上 10 天:This example adds 10 days to the specified timestamp:

addDays('2018-03-15T13:00:00.000Z', 10)

並傳回結果 2018-03-25T00:00:00.000ZAnd returns the result 2018-03-25T00:00:00.000Z.

範例 2Example 2

此範例會從指定的時間戳記中減去五天:This example subtracts five days from the specified timestamp:

addDays('2018-03-15T00:00:00.000Z', -5)

並傳回結果 2018-03-10T00:00:00.000ZAnd returns the result 2018-03-10T00:00:00.000Z.

範例 3Example 3

此範例會在 取消 刪除地區設定中,將 1 天新增至指定的時間戳記:This examples adds 1 day to the specified timestamp in the de-DE locale:

addDays('2018-03-15T13:00:00.000Z', 1, '', 'de-dE')

並傳回結果 16.03.18 13:00:00And returns the result 16.03.18 13:00:00.

addHoursaddHours

以選擇性的地區設定格式,將小時數新增至時間戳記。Add a number of hours to a timestamp in an optional locale format.

addHours('<timestamp>', <hours>, '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<hours><hours> Yes integerinteger 要加入的時數 (正數或負數)The positive or negative number of hours to add
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 時間戳記加上指定的時數The timestamp plus the specified number of hours

範例 1Example 1

此範例會在指定的時間戳記中加上 10 個 小時:This example adds 10 hours to the specified timestamp:

addHours('2018-03-15T00:00:00.000Z', 10)

並傳回結果 2018-03-15T10:00:00.000ZAnd returns the result 2018-03-15T10:00:00.000Z.

範例 2Example 2

此範例會從指定的時間戳記中減去五小時:This example subtracts five hours from the specified timestamp:

addHours('2018-03-15T15:00:00.000Z', -5)

並傳回結果 2018-03-15T10:00:00.000ZAnd returns the result 2018-03-15T10:00:00.000Z.

範例 3Example 3

此範例會在 解除 刪除地區設定的指定時間戳記加上 2 小時:This examples adds 2 hours to the specified timestamp in the de-DE locale:

addHours('2018-03-15T13:00:00.000Z', 2, '', 'de-DE')

並傳回結果 15.03.18 15:00:00And returns the result 15.03.18 15:00:00.

addMinutesaddMinutes

以選擇性的地區設定格式,新增時間戳記的分鐘數。Add a number of minutes to a timestamp in an optional locale format.

addMinutes('<timestamp>', <minutes>, '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<minutes><minutes> Yes integerinteger 要加入的分鐘數 (正數或負數)The positive or negative number of minutes to add
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 時間戳記加上指定的分鐘數The timestamp plus the specified number of minutes

範例 1Example 1

此範例會在指定的時間戳記中加上 10 分鐘:This example adds 10 minutes to the specified timestamp:

addMinutes('2018-03-15T00:10:00.000Z', 10)

並傳回結果 2018-03-15T00:20:00.000ZAnd returns the result 2018-03-15T00:20:00.000Z.

範例 2Example 2

此範例會從指定的時間戳記中減去五分鐘:This example subtracts five minutes from the specified timestamp:

addMinutes('2018-03-15T00:20:00.000Z', -5)

並傳回結果 2018-03-15T00:15:00.000ZAnd returns the result 2018-03-15T00:15:00.000Z.

範例 3Example 3

此範例會在 取消 刪除地區設定的指定時間戳記加上 30 分鐘:This examples adds 30 minutes to the specified timestamp in the de-DE locale:

addMinutes('2018-03-15T00:00:00.000Z', 30, '', 'de-DE')

並傳回結果 15.03.18 13:30:00And returns the result 15.03.18 13:30:00.

addOrdinaladdOrdinal

傳回輸入數字的序數。Return the ordinal number of the input number.

addOrdinal(<number>)
參數Parameter 必要Required 類型Type 描述Description
<number><number> Yes integerinteger 要轉換成序數的數字The numbers to convert to an ordinal number
傳回值Return value 類型Type 描述Description
<result><result> 字串string 從輸入數字轉換的序數The ordinal number converted from the input number

範例Example

addOrdinal(11)
addOrdinal(12)
addOrdinal(13)
addOrdinal(21)
addOrdinal(22)
addOrdinal(23)

並分別傳回下列結果:And respectively returns these results:

  • 11th11th
  • 12th12th
  • 13th13th
  • 21st21st
  • 22nd22nd
  • 23rd23rd

addPropertyaddProperty

將屬性和其值或成對的名稱和數值新增至 JSON 物件,並傳回更新的物件。Add a property and its value, or name-value pair, to a JSON object, and return the updated object. 如果物件已存在於執行階段中,函式會擲回錯誤。If the object already exists at runtime the function throws an error.

addProperty('<object>', '<property>', value)
參數Parameter 必要Required 類型Type 描述Description
<object><object> Yes 物件 (object)object 您要對其新增屬性的 JSON 物件The JSON object where you want to add a property
<property><property> Yes 字串string 要新增之屬性的名稱The name of the property to add
<value><value> Yes 任意any 屬性的值The value of the property
傳回值Return value 類型Type 描述Description
<updated-object><updated-object> 物件 (object)object 新增新屬性之後的已更新 JSON 物件The updated JSON object after adding a new property

範例Example
此範例會將 accountNumber 屬性新增至 customerProfile 物件,此物件是以 json() 函式轉換成 JSON 的。This example adds the accountNumber property to the customerProfile object, which is converted to JSON with the json() function. 函式會指派由newGuid() 函式產生的值,並傳回更新的物件:The function assigns a value that is generated by the newGuid() function, and returns the updated object:

addProperty(json('customerProfile'), 'accountNumber', newGuid())

addSecondsaddSeconds

將秒數加入時間戳記。Add a number of seconds to a timestamp.

addSeconds('<timestamp>', <seconds>, '<format>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<seconds><seconds> Yes integerinteger 要加入的秒數 (正數或負數)The positive or negative number of seconds to add
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 時間戳記加上指定的秒數The timestamp plus the specified number of seconds

範例 1Example 1

此範例會在指定的時間戳記中加上 10 秒鐘:This example adds 10 seconds to the specified timestamp:

addSeconds('2018-03-15T00:00:00.000Z', 10)

並傳回結果 2018-03-15T00:00:10.000ZAnd returns the result 2018-03-15T00:00:10.000Z.

範例 2Example 2

此範例會在指定的時間戳記中減去 5 秒鐘:This example subtracts five seconds to the specified timestamp:

addSeconds('2018-03-15T00:00:30.000Z', -5)

並傳回結果 2018-03-15T00:00:25.000ZAnd returns the result 2018-03-15T00:00:25.000Z.

addToTimeaddToTime

以選擇性的地區設定格式,將數個時間單位新增至時間戳記。Add a number of time units to a timestamp in an optional locale format. 另請參閱 getFutureTime()See also getFutureTime().

addToTime('<timestamp>', '<interval>', <timeUnit>, '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<interval><interval> Yes integerinteger 要加入的指定時間單位數字The number of specified time units to add
<timeUnit><timeUnit> Yes 字串string interval 搭配使用的時間單位。The unit of time to use with interval. 可能的單位為 "Second"、"Minute"、"Hour"、"Day"、"Week"、"Month" 與 "Year"。Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 時間戳記加上指定格式的指定時間單位數。The timestamp plus the number of specified time units with given format.

範例 1Example 1

此範例會在指定的時間戳記中加上一天。This example adds one day to specified timestamp.

addToTime('2018-01-01T00:00:00.000Z', 1, 'Day')

並傳回結果 2018-01-02T00:00:00.000ZAnd returns the result 2018-01-02T00:00:00.000Z.

範例 2Example 2

此範例會在指定的時間戳記中加上兩週。This example adds two weeks to the specified timestamp.

addToTime('2018-01-01T00:00:00.000Z', 2, 'Week', 'MM-DD-YY')

並傳回 'MM-DD-YY' 格式的結果,例如 01-15-18And returns the result in the 'MM-DD-YY' format as 01-15-18.

and

檢查是否所有運算式都是 True。Check whether all expressions are true. 如果所有的運算式都為 True,則傳回 true;如果至少有一個運算式為 False,則傳回 falseReturn true if all expressions are true, or return false if at least one expression is false.

and(<expression1>, <expression2>, ...)
參數Parameter 必要Required 類型Type 描述Description
<expression1>, <expression2>, ...<expression1>, <expression2>, ... Yes BooleanBoolean 要檢查的運算式The expressions to check
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果所有運算式都為 True,則傳回 trueReturn true if all expressions are true. 如果至少有一個運算式為 False,則傳回 falseReturn false if at least one expression is false.

範例 1Example 1

這些範例會檢查指定的布林值是否都是 True:These examples check whether the specified Boolean values are all true:

and(true, true)
and(false, true)
and(false, false)

並分別傳回下列結果:And respectively returns these results:

  • 兩個運算式都是 True,因此函式傳回 trueBoth expressions are true, so the functions returns true.
  • 一個運算式為 False,因此函式傳回 falseOne expression is false, so the functions returns false.
  • 兩個運算式都是 False,所以函式傳回 falseBoth expressions are false, so the function returns false.

範例 2Example 2

這些範例會檢查指定的運算式是否都是 True:These examples check whether the specified expressions are all true:

and(equals(1, 1), equals(2, 2))
and(equals(1, 1), equals(1, 2))
and(equals(1, 2), equals(1, 3))

並分別傳回下列結果:And respectively returns these results:

  • 兩個運算式都是 True,因此函式傳回 trueBoth expressions are true, so the functions returns true.
  • 一個運算式為 False,因此函式傳回 falseOne expression is false, so the functions returns false.
  • 兩個運算式都是 False,因此函式傳回 falseBoth expressions are false, so the functions returns false.

averageaverage

傳回數值陣列的平均值。Return the number average of a numeric array.

average(<numericArray>)
參數Parameter 必要Required 類型Type 描述Description
<numericArray><numericArray> Yes 數字陣列array of number 要計算平均值的輸入陣列The input array to calculate the average
傳回值Return value 類型Type 描述Description
<average-of-array><average-of-array> numbernumber 給定陣列的平均值The average value of the given array

範例Example

此範例會計算 createArray() 中陣列的平均值:This example calculates the average of the array in createArray():

average(createArray(1,2,3))

並傳回結果 2And returns the result 2.

base64base64

傳回字串或位元組陣列的 Base64 編碼版本。Return the base64-encoded version of a string or byte array.

base64('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串或位元組陣列string or byte array 輸入字串The input string
傳回值Return value 類型Type 描述Description
<base64-string><base64-string> 字串string 輸入字串的 Base64 編碼版本The base64-encoded version of the input string

範例 1Example 1

此範例會將 hello 字串轉換成 Base64 編碼字串:This example converts the string hello to a base64-encoded string:

base64('hello')

並傳回結果 "aGVsbG8="And returns the result "aGVsbG8=".

範例 2Example 2

此範例會採用 byteArr,這等於 new byte[] { 3, 5, 1, 12 }This examples takes byteArr, which equals new byte[] { 3, 5, 1, 12 }:

base64('byteArr')

並傳回結果 "AwUBDA=="And returns the result "AwUBDA==".

base64ToBinarybase64ToBinary

傳回 Base64 編碼字串的二進位陣列。Return the binary array of a base64-encoded string.

base64ToBinary('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換的 base64 編碼字串The base64-encoded string to convert
傳回值Return value 類型Type 描述Description
<binary-for-base64-string><binary-for-base64-string> 位元組陣列byte array Base64 編碼字串的二進位版本The binary version of the base64-encoded string

範例Example

此範例會將 Base64 編碼字串 AwUBDA== 轉換成二進位字串:This example converts the base64-encoded string AwUBDA== to a binary string:

base64ToBinary('AwUBDA==')

並傳回結果 new byte[] { 3, 5, 1, 12 }And returns the result new byte[] { 3, 5, 1, 12 }.

base64ToStringbase64ToString

傳回 Base64 編碼字串的字串版本,也就是有效地將 Base64 字串解碼。Return the string version of a base64-encoded string, effectively decoding the base64 string.

base64ToString('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要解碼的 base64 編碼字串The base64-encoded string to decode
傳回值Return value 類型Type 描述Description
<decoded-base64-string><decoded-base64-string> 字串string Base64 編碼字串的字串版本The string version of a base64-encoded string

範例Example

此範例會將 Base64 編碼字串 aGVsbG8= 轉換成已解碼的字串:This example converts the base64-encoded string aGVsbG8= to a decoded string:

base64ToString('aGVsbG8=')

並傳回結果 helloAnd returns the result hello.

BINARYbinary

傳回字串的二進位版本。Return the binary version of a string.

binary('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換的字串The string to convert
傳回值Return value 類型Type 描述Description
<binary-for-input-value><binary-for-input-value> 位元組陣列byte array 指定字串的二進位版本The binary version of the specified string

範例Example

此範例會將字串 hello 轉換成二進位字串:This example converts the string hello to a binary string:

binary('hello')

並傳回結果 new byte[] { 104, 101, 108, 108, 111 }And returns the result new byte[] { 104, 101, 108, 108, 111 }.

boolbool

傳回值的布林值版本。Return the Boolean version of a value.

bool(<value>)
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 任意any 要轉換的值The value to convert
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 指定值的布林值版本The Boolean version of the specified value

範例Example

這些範例會將指定的值轉換為布林值:These examples convert the specified values to Boolean values:

bool(1)
bool(0)

並分別傳回下列結果:And respectively returns these results:

  • true
  • false

ceilingceiling

傳回小於或等於指定數位的最大整數值。Return the largest integral value less than or equal to the specified number.

ceiling('<number>')
參數Parameter 必要Required 類型Type 描述Description
<number><number> Yes numbernumber 輸入編號An input number
傳回值Return value 類型Type 描述Description
<整數值><integer-value> integerinteger 大於或等於輸入數位的最大整數值The largest integral value greater than or equal to the input number

範例Example

此範例會傳回小於或等於數位 10.333 的最大整數值:This example returns the largest integral value less than or equal to the number 10.333:

ceiling(10.333)

並傳回整數 11And returns the integer 11.

coalescecoalesce

從一個或多個參數中傳回第一個非 Null 值。Return the first non-null value from one or more parameters. 空白字串、空白陣列和空白物件不是 null。Empty strings, empty arrays, and empty objects are not null.

coalesce(<object**1>, <object**2>, ...)
參數Parameter 必要Required 類型Type 描述Description
<object**1>, <object**2>, ...<object**1>, <object**2>, ... Yes 任何類型 (可接受混合類型)any (mixed types acceptable) 要檢查是否有 Null 的一個或多個項目One or more items to check for null
傳回值Return value 類型Type 描述Description
<first-non-null-item><first-non-null-item> 任意any 第一個不是 Null 的項目或值。The first item or value that is not null. 如果所有參數都是 Null,則此函式會傳回 Null。If all parameters are null, this function returns null.

範例Example

這些範例會從指定值傳回第一個非 Null 的值,或是,如果所有值都是 Null,則傳回 Null:These examples return the first non-null value from the specified values, or null when all the values are null:

coalesce(null, true, false)
coalesce(null, 'hello', 'world')
coalesce(null, null, null)

和分別傳回:And respectively return:

  • true
  • hellohello
  • nullnull

concatconcat

結合兩個或多個物件,並傳回清單或字串中的合併物件。Combine two or more objects, and return the combined objects in a list or string.

concat('<text1>', '<text2>', ...)
參數Parameter 必要Required 類型Type 描述Description
<object1>, <object2>, ...<object1>, <object2>, ... Yes 任意any 至少要有兩個物件。At least two objects to concat.
傳回值Return value 類型Type 描述Description
<object1object2...><object1object2...> 字串或清單string or list 合併的字串或清單。The combined string or list. 略過 Null 值。Null values are skipped.

預期的傳回值:Expected return values:

  • 如果所有專案都是清單,則會傳回清單。If all items are lists, a list will be returned.
  • 如果有專案不是清單,則會傳回字串。If there exists an item that is not a list, a string will be returned.
  • 如果值為 null,則會略過,而不會 concatanated。If a value is null, it is skipped and not concatanated.

範例Example

此範例會合併字串 HelloWorldThis example combines the strings Hello and World:

concat('Hello', 'World')

並傳回結果 HelloWorldAnd returns the result HelloWorld.

範例 2Example 2

此範例結合了清單 [1,2][3,4]This example combines the lists [1,2] and [3,4]:

concat([1,2],[3,4])

並傳回結果 [1,2,3,4]And returns the result [1,2,3,4].

範例 3Example 3

這些範例結合不同類型的物件:These examples combine objects of different types:

concat('a', 'b', 1, 2)
concat('a', [1,2])

並分別傳回下列結果:And return the following results respectively:

  • 字串 ab12The string ab12.
  • System 物件。 清單 1 [system.object]The object aSystem.Collections.Generic.List 1[System.Object]. 這是不可讀的,且最好避免。This is unreadable and best to avoid.

範例 4Example 4

這些範例合併物件將會 nullThese example combine objects will null:

concat([1,2], null)
concat('a', 1, null)

並分別傳回下列結果:And return the following results respectively:

  • 清單 [1,2]The list [1,2].
  • 字串 a1The string a1.

containscontains

檢查集合是否具有特定項目。Check whether a collection has a specific item. 如果找到項目,則傳回 true;如果找不到,則傳回 falseReturn true if the item is found, or return false if not found. 此函式會區分大小寫。This function is case-sensitive.

contains('<collection>', '<value>')
contains([<collection>], '<value>')

此函式會用在下列集合類型上:This function works on the following collection types:

  • 要尋找子字串的字串A string to find a substring
  • 要尋找值的陣列An array to find a value
  • 要尋找機碼的字典A dictionary to find a key
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串、陣列或字典string, array, or dictionary 要檢查的集合The collection to check
<value><value> Yes 個別的字串、陣列或字典string, array, or dictionary, respectively 要尋找的項目The item to find
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果找到項目,則傳回 trueReturn true if the item is found. 如果找不到,則傳回 falseReturn false if not found.

範例 1Example 1

此範例會檢查字串 hello world 是否有子字串 worldThis example checks the string hello world for the substring world:

contains('hello world', 'world')

並傳回結果 trueAnd returns the result true.

範例 2Example 2

此範例會檢查字串 hello world 是否有子字串 universeThis example checks the string hello world for the substring universe:

contains('hello world', 'universe')

並傳回結果 falseAnd returns the result false.

countcount

傳回集合中的項目數目。Return the number of items in a collection.

count('<collection>')
count([<collection>])
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串或陣列string or array 要計算其項目數的集合The collection with the items to count
傳回值Return value 類型Type 描述Description
<length-or-count><length-or-count> integerinteger 集合中的項目數目The number of items in the collection

範例Examples:

這些範例會計算以下集合中的項目數:These examples count the number of items in these collections:

count('abcd')
count(createArray(0, 1, 2, 3))

兩者都會傳回結果 4And both return the result 4.

countWordcountWord

傳回字串中的單字數Return the number of words in a string

countWord('<text>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要計算的字串The string to count
傳回值Return value 類型Type 描述Description
<count><count> integerinteger 字串中的單字數The number of words in the string

範例Example

此範例會計算字串 hello world 中的單字數:This example counts the number of words in the string hello world:

countWord("hello word")

並傳回結果 2And it returns the result 2.

convertFromUTCconvertFromUTC

將選擇性地區設定格式的時間戳記從國際標準時間協調 (UTC) 轉換為目標時區。Convert a timestamp in an optional locale format from Universal Time Coordinated (UTC) to a target time zone.

convertFromUTC('<timestamp>', '<destinationTimeZone>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<destinationTimeZone><destinationTimeZone> Yes 字串string 目標時區的名稱。The name of the target time zone. 支援 Windows 與 Iana 時區。Supports Windows and Iana time zones.
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式是 "o" 格式,yyyy-mm-dd ddTHH: mm: Ss. fffffffK,其符合 ISO 8601The default format for the timestamp is the "o" format, yyyy-MM-ddTHH:mm:ss.fffffffK, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<converted-timestamp><converted-timestamp> 字串string 轉換為目標時區的時間戳記The timestamp converted to the target time zone

範例Examples:

這些範例會從 UTC 轉換成太平洋標準時間:These examples convert from UTC to Pacific Standard Time:

convertFromUTC('2018-02-02T02:00:00.000Z', 'Pacific Standard Time', 'MM-DD-YY')
convertFromUTC('2018-02-02T02:00:00.000Z', 'Pacific Standard Time')

並分別傳回下列結果:And respectively return these results:

  • 02-01-1802-01-18
  • 2018-01-01T18:00:00.00000002018-01-01T18:00:00.0000000

範例 2Example 2

此範例會將 en-us 地區設定中的時間戳記從 UTC 轉換為太平洋標準時間:This example converts a timestamp in the en-US locale from UTC to Pacific Standard Time:

convertFromUTC('2018-01-02T02:00:00.000Z', 'Pacific Standard Time', 'D', 'en-US')

並傳回 2018 年1月1日星期一 的結果。And returns the result Monday, January 1, 2018.

convertToUTCconvertToUTC

將選擇性地區設定格式的時間戳記轉換為國際標準時間協調 (UTC) 自來源時區。Convert a timestamp in an optional locale format to Universal Time Coordinated (UTC) from the source time zone.

convertToUTC('<timestamp>', '<sourceTimeZone>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<sourceTimeZone><sourceTimeZone> Yes 字串string 目標時區的名稱。The name of the target time zone. 支援 Windows 與 Iana 時區。Supports Windows and Iana time zones.
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<converted-timestamp><converted-timestamp> 字串string 轉換為目標時區的時間戳記The timestamp converted to the target time zone

範例Example

此範例會將時間戳記從太平洋標準時間轉換成 UTC。This example converts a timestamp to UTC from Pacific Standard Time

convertToUTC('01/01/2018 00:00:00', 'Pacific Standard Time')

並傳回 2018-01-01T08:00: 00.000 z 的結果。And returns the result 2018-01-01T08:00:00.000Z.

範例 2Example 2

此範例會將 解除 刪除地區設定中的時間戳記轉換為太平洋標準時間的 UTC:This example converts a timestamp in the de-DE locale to UTC from Pacific Standard Time:

convertToUTC('01/01/2018 00:00:00', 'Pacific Standard Time', '', 'de-DE')

並傳回結果 01.01.18 08:00:00And returns the result 01.01.18 08:00:00.

createArraycreateArray

從多個輸入傳回陣列。Return an array from multiple inputs.

createArray('<object1>', '<object2>', ...)
參數Parameter 必要Required 類型Type 描述Description
<object1>, <object2>, ...<object1>, <object2>, ... Yes 任何類型,但不能是混合any, but not mixed 用來建立陣列的至少兩個項目At least two items to create the array
傳回值Return value 類型Type 描述Description
[<object1>, <object2>, ...][<object1>, <object2>, ...] arrayarray 從所有輸入項目建立的陣列The array created from all the input items

範例Example

此範例會從下列輸入建立陣列:This example creates an array from the following inputs:

createArray('h', 'e', 'l', 'l', 'o')

並傳回結果 [h ,e, l, l, o]And returns the result [h ,e, l, l, o].

dataUridataUri

傳回字串的資料統一資源識別項 (URI)。Return a data uniform resource identifier (URI) of a string.

dataUri('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換的字串The string to convert
傳回值Return value 類型Type 描述Description
[<date-uri>][<date-uri>] 字串string 輸入字串的資料 URIThe data URI for the input string

範例Example

dataUri('hello')

傳回結果 data:text/plain;charset=utf-8;base64,aGVsbG8=Returns the result data:text/plain;charset=utf-8;base64,aGVsbG8=.

dataUriToBinarydataUriToBinary

傳回資料統一資源識別項 (URI) 的二進位版本。Return the binary version of a data uniform resource identifier (URI).

dataUriToBinary('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換的資料 URIThe data URI to convert
傳回值Return value 類型Type 描述Description
[<binary-for-data-uri>][<binary-for-data-uri>] 位元組陣列byte array 資料 URI 的二進位版本The binary version of the data URI

範例Example

此範例會建立下列資料 URI 的二進位版本:This example creates a binary version for the following data URI:

dataUriToBinary('aGVsbG8=')

並傳回結果 new byte[] { 97, 71, 86, 115, 98, 71, 56, 61 }And returns the result new byte[] { 97, 71, 86, 115, 98, 71, 56, 61 }.

dataUriToStringdataUriToString

傳回資料統一資源識別項 (URI) 的字串版本。Return the string version of a data uniform resource identifier (URI).

dataUriToString('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換的資料 URIThe data URI to convert
傳回值Return value 類型Type 描述Description
[<string-for-data-uri>][<string-for-data-uri>] 字串string 資料 URI 的字串版本The string version of the data URI

範例Example

此範例會從下列資料 URI 建立字串:This example creates a string from the following data URI:

dataUriToString('data:text/plain;charset=utf-8;base64,aGVsbG8=')

並傳回結果 helloAnd returns the result hello.

datedate

m/dd/yyyy 格式傳回指定時間戳記的日期。Return the date of a specified timestamp in m/dd/yyyy format.

date('<timestramp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
傳回值Return value 類型Type 描述Description
<date><date> 字串string 指定時間戳記的日期The date of the specified timestamp
date('2018-03-15T13:00:00.000Z')

傳回結果 3-15-2018Returns the result 3-15-2018.

dateReadBackdateReadBack

使用 date-time 程式庫提供日期回讀。Uses the date-time library to provide a date readback.

dateReadBack('<currentDate>', '<targetDate>')
參數Parameter 必要Required 類型Type 描述Description
<currentDate><currentDate> Yes 字串string 包含目前日期的字串The string that contains the current date
<targetDate><targetDate> Yes 字串string 包含目標日期的字串The string that contains the target date
傳回值Return value 類型Type 描述Description
<date-readback><date-readback> 字串string 目前日期與目標日期之間的回讀The readback between current date and the target date

範例 1Example 1

dateReadBack('2018-03-15T13:00:00.000Z', '2018-03-16T13:00:00.000Z')

傳回結果 明天Returns the result tomorrow.

dateTimeDiffdateTimeDiff

傳回兩個時間戳記之間的刻度差異。Return the difference in ticks between two timestamps.

dateTimeDiff('<timestamp1>', '<timestamp2>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp1><timestamp1> Yes 字串string 要比較的第一個時間戳記字串The first timestamp string to compare
<timestamp2><timestamp2> Yes 字串string 要比較的第二個時間戳記字串The second timestamp string to compare
傳回值Return value 類型Type 描述Description
<><ticks> numbernumber 兩個時間戳記之間的刻度差異The difference in ticks between two timestamps

範例 1Example 1

此範例會傳回兩個時間戳記之間的刻度差異:This example returns the difference in ticks between two timestamps:

dateTimeDiff('2019-01-01T08:00:00.000Z','2018-01-01T08:00:00.000Z')

並傳回數位 315360000000000And returns the number 315360000000000.

範例 2Example 2

此範例會傳回兩個時間戳記之間的刻度差異:This example returns the difference in ticks between two timestamps:

dateTimeDiff('2018-01-01T08:00:00.000Z', '2019-01-01T08:00:00.000Z')

傳回結果 -315360000000000Returns the result -315360000000000. 請注意,此值為負數。Note that the value is a negative number.

dayOfMonthdayOfMonth

傳回時間戳記中的當月日期。Return the day of the month from a timestamp.

dayOfMonth('<timestamp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
傳回值Return value 類型Type 描述Description
<day-of-month><day-of-month> integerinteger 在指定時間戳記中的當月日期The day of the month from the specified timestamp

範例Example

此範例會傳回下列時間戳記中的當月日期數字:This example returns the number for the day of the month from the following timestamp:

dayOfMonth('2018-03-15T13:27:36Z')

並傳回結果 15And returns the result 15.

dayOfWeekdayOfWeek

從時間戳記傳回當週的第幾天。Return the day of the week from a timestamp.

dayOfWeek('<timestamp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
傳回值Return value 類型Type 描述Description
<day-of-week><day-of-week> integerinteger 指定時間戳記上的星期幾。The day of the week from the specified timestamp. 星期日是 0、星期一是 1,依此類推。Sunday is 0, Monday is 1, and so forth.

範例Example

此範例會從下列時間戳記傳回星期幾的數字:This example returns the number for the day of the week from the following timestamp:

dayOfWeek('2018-03-15T13:27:36Z')

並傳回結果 3And returns the result 3.

dayOfYeardayOfYear

從時間戳記傳回一年的第幾天。Return the day of the year from a timestamp.

dayOfYear('<timestamp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
傳回值Return value 類型Type 描述Description
<day-of-year><day-of-year> integerinteger 在指定時間戳記上那一年的第幾天The day of the year from the specified timestamp

範例Example

此範例會從下列時間戳記傳回年份日期的數字:This example returns the number of the day of the year from the following timestamp:

dayOfYear('2018-03-15T13:27:36Z')

並傳回結果 74And returns the result 74.

divdiv

傳回兩數相除的整數結果。Return the integer result from dividing two numbers. 若要傳回餘數,請參閱 mod()To return the remainder see mod().

div(<dividend>, <divisor>)
參數Parameter 必要Required 類型Type 描述Description
<dividend><dividend> Yes numbernumber 要除以「除數」的數字The number to divide by the divisor
<divisor><divisor> Yes numbernumber 要除「被除數」的數字。The number that divides the dividend. 不能為 0。Cannot be 0.
傳回值Return value 類型Type 描述Description
<quotient-result><quotient-result> numbernumber 第一個數字除以第二個數字的結果The result from dividing the first number by the second number

範例Example

這兩個範例會將第一個數字除以第二個數字:Both examples divide the first number by the second number:

div(10, 5)
div(11, 5)

並傳回結果 2And return the result 2.

如果其中一個參數是浮點數,結果也會是浮點數。If one of the parameters is a float, the result will be also be a float.

範例Example

div(11.2, 3)

傳回結果 5.5Returns the result 5.5.

emptyempty

檢查執行個體是否空白。Check whether an instance is empty. 如果輸入是空白,則傳回 trueReturn true if the input is empty. 空白表示:Empty means:

  • 輸入為 Null 或未定義input is null or undefined
  • 輸入為 Null 或空字串input is a null or empty string
  • 輸入為零大小的集合input is zero size collection
  • 輸入為沒有屬性的物件。input is an object with no property.
empty('<instance>')
empty([<instance>])
參數Parameter 必要Required 類型Type 描述Description
<instance><instance> Yes 任意any 要檢查的執行個體The instance to check
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 當執行個體是空白,則傳回 trueReturn true when the instance is empty.

範例Example

這些範例會檢查指定的執行個體是否空白:These examples check whether the specified instance is empty:

empty('')
empty('abc')
empty([1])
empty(null)

並分別傳回下列結果:And return these results respectively:

  • 傳遞空字串,所以函數傳回 truePasses an empty string, so the function returns true.
  • 傳遞字串 abc,因此函式傳回 falsePasses the string abc, so the function returns false.
  • 傳遞具有一個項目的集合,因此函式會傳回 falsePasses the collection with one item, so the function returns false.
  • 傳遞 Null 物件,因此函式會傳回 truePasses the null object, so the function returns true.

endsWithendsWith

檢查字串是否以特定的子字串結束。Check whether a string ends with a specific substring. 如果找到子字串,則傳回 true;如果找不到,則傳回 falseReturn true if the substring is found, or return false if not found. 此函式區分大小寫。This function is case-insensitive.

endsWith('<text>', '<searchText>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要檢查的字串The string to check
<searchText><searchText> Yes 字串string 要尋找的結尾子字串The ending substring to find
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 找到結尾子字串時,傳回 trueReturn true when the ending substring is found. 如果找不到,則傳回 falseReturn false if not found

範例 1Example 1

此範例會檢查 hello world 字串是否以字串 world 結尾:This example checks whether the hello world string ends with the string world:

endsWith('hello world', 'world')

並傳回結果 trueAnd it returns the result true.

範例 2Example 2

此範例會檢查 hello world 字串是否以字串 universe 結尾:This example checks whether the hello world string ends with the string universe:

endsWith('hello world', 'universe')

並傳回結果 falseAnd it returns the result false.

EolEOL

僅限 C#。C# only. 傳回 (EOL) 序列文字的行尾。Return the end of line (EOL) sequence text.

EOL()
傳回值Return value 類型Type 描述Description
<IsOSPlatform><IsOSPlatform> 字串string 在 Windows 中返回 \r\n ,在 Mac 和 Linux 中傳回 \nReturn \r\n in Windows and \n in Mac and Linux.

範例Example

此範例會檢查行序列文字的結尾:This example checks the end of the line sequence text:

EOL()

並傳回下列字串:And returns the following strings:

  • Windows: \r\nWindows: \r\n
  • Mac 或 Linux: \nMac or Linux: \n

equalsequals

檢查兩個值、運算式或物件是否相等。Check whether both values, expressions, or objects are equivalent. 如果兩者相等,則傳回 true;如果兩者不相等,則傳回 falseReturn true if both are equivalent, or return false if they're not equivalent.

equals('<object1>', '<object2>')
參數Parameter 必要Required 類型Type 描述Description
<object1>, <object2><object1>, <object2> Yes 任意any 要比較的值、運算式或物件The values, expressions, or objects to compare
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 兩者相等時,傳回 trueReturn true when both are equivalent. 如果不相等,則傳回 falseReturn false if not equivalent.

範例Example

這些範例會檢查指定的輸入是否相等:These examples check whether the specified inputs are equivalent:

equals(true, 1)
equals('abc', 'abcd')

並分別傳回下列結果:And returns these results respectively:

  • 兩個值相等,所以函數傳回 trueBoth values are equivalent, so the function returns true.
  • 兩個值不相等,所以函式傳回 falseBoth values aren't equivalent, so the function returns false.

existsexists

評估運算式的真實性。Evaluates an expression for truthiness.

exists(expression)
參數Parameter 必要Required 類型Type 描述Description
expressionexpression Yes expressionexpression 要評估真實性的運算式Expression to evaluate for truthiness
傳回值Return value 類型Type 描述Description
<True 或 False><true or false> BooleanBoolean 評估運算式的結果Result of evaluating the expression

範例Example

這些範例會評估 foo = {"bar":"value"} 的真實性:These example evaluate the truthiness of foo = {"bar":"value"}:

exists(foo.bar)
exists(foo.bar2)

並分別傳回下列結果:And return these results respectively:

  • true
  • false

expexp

傳回兩數的乘冪。Return exponentiation of one number to another.

exp(realNumber, exponentNumber)
參數Parameter 必要Required 類型Type 描述Description
realNumberrealNumber Yes numbernumber 要計算指數的實數Real number to compute exponent of
exponentNumberexponentNumber Yes numbernumber 指數數字Exponent number
傳回值Return value 類型Type 描述Description
<result-exp><result-exp> numbernumber 計算 realNumber 指數的結果The result from computing exponent of realNumber

範例Example

這個範例會計算指數:This example computes the exponent:

exp(2, 2)

並傳回結果 4And returns the result 4.

firstfirst

傳回字串或陣列中的第一個項目。Return the first item from a string or array.

first('<collection>')
first([<collection>])
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串或陣列string or array 要從中尋找第一個項目的集合The collection in which to find the first item
傳回值Return value 類型Type 描述Description
<first-collection-item><first-collection-item> 任意any 集合中的第一個項目The first item in the collection

範例Example

這些範例會尋找下列集合中第一個項目:These examples find the first item in the following collections:

first('hello')
first(createArray(0, 1, 2))

並分別傳回下列結果:And return these results respectively:

  • hh
  • 00

扁平化flatten

將陣列壓平合併為非陣列值。Flatten an array into non-array values. 您可以選擇性地設定要壓平合併的最大深度。You can optionally set the maximum depth to flatten to.

flatten([<collection>], '<depth>')
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes arrayarray 要壓平合併的集合The collection to flatten
<depth><depth> No numbernumber 壓平合併的最大深度。Maximum depth to flatten. 預設值為無限大。Default is infinity.
傳回值Return value 類型Type 描述Description
<new-collection><new-collection> arrayarray 新集合,其元素已壓平合併為指定深度的非陣列New collection whose elements have been flattened to a non-array to the specified depth

範例 1Example 1

此範例會壓平合併下列陣列:THis example flattens the following array:

flatten(createArray(1, createArray(2), createArray(createArray(3, 4), createArray(5, 6)))

並傳回結果 [1, 2, 3, 4, 5, 6]And returns the result [1, 2, 3, 4, 5, 6].

範例 2Example 2

此範例會將陣列壓平合併至深度 1This example flattens the array to a depth of 1:

flatten(createArray(1, createArray(2), createArray(createArray(3, 4), createArray(5, 6)), 1)

並傳回結果 [1, 2, [3, 4], [5, 6]]And returns the result [1, 2, [3, 4], [5, 6]].

FLOATfloat

將浮點數的字串版本轉換成浮點數。Convert the string version of a floating-point number to a floating-point number. 您只可在將自訂參數傳遞給應用程式 (例如邏輯應用程式) 時使用這個函式。You can use this function only when passing custom parameters to an app, such as a logic app. 如果字串無法轉換成浮點數,則會擲回例外狀況。An exception will be thrown if the string cannot be converted to a float.

float('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 具有要轉換之有效浮點數的字串The string that has a valid floating-point number to convert to
傳回值Return value 類型Type 描述Description
<float-value><float-value> FLOATfloat 指定字串的浮點數The floating-point number of the specified string

範例Example

此範例會轉換字串的 float 版本:This example converts the float version of a string:

float('10.333')

並傳回浮點數 10.333And returns the float 10.333.

floorfloor

傳回小於或等於指定數位的最大整數值。Return the largest integral value less than or equal to the specified number.

floor('<number>')
參數Parameter 必要Required 類型Type 描述Description
<number><number> Yes numbernumber 輸入編號An input number
傳回值Return value 類型Type 描述Description
<整數值><integer-value> integerinteger 小於或等於輸入數位的最大整數值The largest integral value less than or equal to the input number

範例Example

此範例會計算數位 10.333 的樓層值:This example calculates the floor value of the number 10.333:

floor(10.333)

並傳回整數 10And returns the integer 10.

foreachforeach

在每個元素上操作,並傳回新的集合。Operate on each element and return the new collection.

foreach([<collection/instance>], <iteratorName>, <function>)
參數Parameter 必要Required 類型Type 描述Description
<collection/instance><collection/instance> Yes 陣列或物件array or object 包含項目的集合The collection with the items
<iteratorName><iteratorName> Yes 迭代器名稱iterator name 箭號函式的機碼項目The key item of arrow function
<function><function> Yes expressionexpression 包含 iteratorName 的函式Function that contains iteratorName
傳回值Return value 類型Type 描述Description
<new-collection><new-collection> arrayarray 新集合,其中每個元素均已由函式評估The new collection in which each element has been evaluated by the function

範例 1Example 1

此範例會產生新的集合:This example generates a new collection:

foreach(createArray(0, 1, 2, 3), x, x + 1)

並傳回結果 [1, 2, 3, 4]And returns the result [1, 2, 3, 4].

範例 2Example 2

這些範例會產生新的集合:These examples generate a new collection:

foreach(json("{'name': 'jack', 'age': '15'}"), x, concat(x.key, ':', x.value))
foreach(json("{'name': 'jack', 'age': '15'}"), x=> concat(x.key, ':', x.value))

並傳回結果 [' name:插口 ',' age: 15 ']And return the result ['name:jack', 'age:15']. 請注意,第二個運算式是 lambda 運算式,可讓您找到更容易讀取的運算式。Note that the second expression is a lambda expression, which some find more readable.

formatDateTimeformatDateTime

傳回選用地區設定格式的時間戳記。Return a timestamp in an optional locale format.

formatDateTime('<timestamp>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<reformatted-timestamp><reformatted-timestamp> 字串string 所指定格式的更新時間戳記The updated timestamp in the specified format

範例 1Example 1

此範例會將時間戳記轉換為指定格式:This example converts a timestamp to the specified format:

formatDateTime('03/15/2018 12:00:00', 'yyyy-MM-ddTHH:mm:ss')

並傳回結果 2018-03-15T12:00: 00And returns the result 2018-03-15T12:00:00.

範例 2Example 2

此範例會以 取消 刪除地區設定來轉換時間戳記:This example converts a timestamp in the de-DE locale:

formatDateTime('2018-03-15', '', 'de-DE')

並傳回結果 15.03.18 00:00:00And returns the result 15.03.18 00:00:00.

formatEpochformatEpoch

從 UNIX 時間以指定的格式傳回選用地區設定格式的時間戳記 (也知道 Epoch 時間、POSIX 時間、UNIX Epoch 時間) 。Return a timestamp in an optional locale format in the specified format from UNIX time (also know as Epoch time, POSIX time, UNIX Epoch time).

formatEpoch('<epoch>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<epoch><epoch> Yes numbernumber Epoch 號碼The epoch number
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<reformatted-timestamp><reformatted-timestamp> 字串string 所指定格式的更新時間戳記The updated timestamp in the specified format

範例Example

此範例會將 Unix 時間戳記轉換為指定的格式:This example converts a Unix timestamp to the specified format:

formatEpoch(1521118800, 'yyyy-MM-ddTHH:mm:ss.fffZ)'

並傳回結果 2018-03-15T12:00:00.000ZAnd returns the result 2018-03-15T12:00:00.000Z.

範例Example

此範例會以 取消 刪除的地區設定來轉換 Unix 時間戳記:This example converts a Unix timestamp in the de-DE locale:

formatEpoch(1521118800, '', 'de-DE')

並傳回結果 15.03.18 13:00:00And returns the result 15.03.18 13:00:00.

formatNumberformatNumber

將值格式化為指定的小數位數和選擇性的指定地區設定。Format a value to the specified number of fractional digits and an optional specified locale.

formatNumber('<number>', '<precision-digits>', '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<number><number> Yes numbernumber 輸入編號An input number
<有效位數-數位><precision-digits> Yes integerinteger 指定的小數位數A specified number of fractional digits
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<傳回值><return-value> numbernumber 以指定的小數位數和指定的地區設定格式化之輸入的傳回值The return value of the input formated at a specified number of fractional digits and a specified locale

範例 1Example 1

此範例會將檔案數位 10.333 的格式格式化為 2 個小數位數:This example formats ther number 10.333 to 2 fractional digits:

formatNumber(10.333, 2)

並傳回字串 10.33And returns the string 10.33.

範例 2Example 2

這些範例會將數位格式設定為 en-us 地區設定中指定的位數:These examples format numbers to a specified number of digits in the en-US locale:

formatNumber(12.123, 4, 'en-US')
formatNumber(1.551, 2, 'en-US')
formatNumber(12.123, 4, 'en-US')

並分別傳回下列結果:And return the following results respectively:

  • 12.1212.12
  • 1.551.55
  • 12.123012.1230

formatTicksformatTicks

以指定的格式,從刻度傳回選用地區設定格式的時間戳記。Return a timestamp in an optional locale format in the specified format from ticks.

formatTicks('<ticks>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<epoch><epoch> Yes 數值 (或 Javascript 中的 BigInt)number (or bigint in Javascript) 刻度數值The ticks number
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<reformatted-timestamp><reformatted-timestamp> 字串string 所指定格式的更新時間戳記The updated timestamp in the specified format

範例 1Example 1

此範例會將刻度轉換為指定格式:This example converts ticks to the specified format:

formatTicks(637243624200000000, 'yyyy-MM-ddTHH:mm:ss.fffZ')

並傳回結果 2020-05-06T11:47:00.000ZAnd returns the result 2020-05-06T11:47:00.000Z.

範例 2Example 2

這個範例會在 取消 設定的地區設定中,將刻度轉換成指定的格式:This example converts ticks to the specified format in the de-DE locale:

formatTicks(637243624200000000, '', 'de-DE')

並傳回結果 06.05.20 11:47:00And returns the result 06.05.20 11:47:00.

getFutureTimegetFutureTime

以選擇性的地區設定格式以及指定的時間單位傳回目前的時間戳記。Return the current timestamp in an optional locale format plus the specified time units.

getFutureTime(<interval>, <timeUnit>, '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<interval><interval> Yes integerinteger 要加入的指定時間單位數字The number of specific time units to add
<timeUnit><timeUnit> Yes 字串string interval 搭配使用的時間單位。The unit of time to use with interval. 可能的單位為 "Second"、"Minute"、"Hour"、"Day"、"Week"、"Month" 與 "Year"。Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 目前時間戳記加上指定的時間單位數字The current timestamp plus the specified number of time units

範例 1Example 1

假設目前的時間戳記是 2019-03-01T00:00:00.000ZSuppose the current timestamp is 2019-03-01T00:00:00.000Z. 下列範例會在時間戳記中加上五天:The example below adds five days to that timestamp:

getFutureTime(2, 'Week')

並傳回結果 2019-03-15T00:00:00.000ZAnd returns the result 2019-03-15T00:00:00.000Z.

範例 2Example 2

假設目前的時間戳記是 2018-03-01T00:00:00.000ZSuppose the current timestamp is 2018-03-01T00:00:00.000Z. 下列範例會在時間戳記中加上五天,並將結果轉換成 MM-DD-YY 格式:The example below adds five days to the timestamp and converts the result to MM-DD-YY format:

getFutureTime(5, 'Day', 'MM-DD-YY')

並傳回結果 03-06-18And returns the result 03-06-18.

範例 3Example 3

假設目前的時間戳記是 2020-05-01T00:00: 00.000 z ,而地區設定是 取消 刪除。Suppose the current timestamp is 2020-05-01T00:00:00.000Z and the locale is de-DE. 下列範例會將 1 天新增至時間戳記:The example below adds 1 day to the timestamp:

getFutureTime(1,'Day', '', 'de-DE')

並傳回結果 02.05.20 00:00:00And returns the result 02.05.20 00:00:00.

getNextViableDategetNextViableDate

根據目前日期和選擇性指定的時區,傳回 timex 運算式的下一個可行日期。Return the next viable date of a timex expression based on the current date and an optionally specified timezone.

getNextViableDate(<timexString>, <timezone>?)
參數Parameter 必要Required 類型Type 描述Description
<timexString><timexString> Yes 字串string 要評估之日期的 timex 字串。The timex string of the date to evaluate.
<時區><timezone> No 字串string 選用的時區。The optional timezone.
傳回值Return value 類型Type 描述Description
<nextViableTime><nextViableTime> 字串string 下一個可行的日期。The next viable date.

範例Examples

假設日期為 2020-06-12 ,而目前時間為 15:42:21Say the date is 2020-06-12 and current time is 15:42:21.

這些範例會根據上述日期和時間評估下一個可行日期的 timex 字串:These examples evaluate the timex string for the next viable date based on the above date and time:

getPreviousViableDate("XXXX-12-20", "America/Los_Angeles")
getPreviousViableDate("XXXX-02-29")

並分別傳回下列字串:And return the following strings respectively:

  • 2020-12-202020-12-20
  • 2024-02-292024-02-29

getNextViableTimegetNextViableTime

根據目前時間和選擇性指定的時區,傳回 timex 運算式的下一個可用時間。Return the next viable time of a timex expression based on the current time and an optionally specified timezone.

getNextViableTime(<timexString>, <timezone>?)
參數Parameter 必要Required 類型Type 描述Description
<timexString><timexString> Yes 字串string 要評估之時間的 timex 字串。The timex string of the time to evaluate.
<時區><timezone> No 字串string 選用的時區。The optional timezone.
傳回值Return value 類型Type 描述Description
<nextViableTime><nextViableTime> 字串string 下一次可行的時間。The next viable time.

範例Examples

假設日期為 2020-06-12 ,而目前時間為 15:42:21Say the date is 2020-06-12 and current time is 15:42:21.

這些範例會根據上述的日期和時間,針對下一個可行時間評估 timex 字串:These examples evaluate a timex string for the next viable time based on the above date and time:

getNextViableTime("TXX:12:14", "Asia/Tokyo")
getNextViableTime("TXX:52:14")

並傳回下列字串 repsectively:And return the following strings repsectively:

  • T16:12:14T16:12:14
  • T15:52:14T15:52:14

getPastTimegetPastTime

傳回目前時間戳記減去指定時間單位的結果。Return the current timestamp minus the specified time units.

getPastTime(<interval>, <timeUnit>, '<format>'?)
參數Parameter 必要Required 類型Type 描述Description
<interval><interval> Yes integerinteger 要減去的指定時間單位數字The number of specific time units to substract
<timeUnit><timeUnit> Yes 字串string interval 搭配使用的時間單位。The unit of time to use with interval. 可能的單位為 "Second"、"Minute"、"Hour"、"Day"、"Week"、"Month" 與 "Year"。Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 目前時間戳記減去指定的時間單位數字The current timestamp minus the specified number of time units

範例 1Example 1

假設目前的時間戳記是 2018-02-01T00:00:00.000ZSuppose the current timestamp is 2018-02-01T00:00:00.000Z. 此範例會從此時間戳記中減去五天:This example subtracts five days from that timestamp:

getPastTime(5, 'Day')

並傳回結果 2019-01-27T00:00:00.000ZAnd returns the result 2019-01-27T00:00:00.000Z.

範例 2Example 2

假設目前的時間戳記是 2018-03-01T00:00:00.000ZSuppose the current timestamp is 2018-03-01T00:00:00.000Z. 此範例會將五天減去 MM DD-YY 格式的時間戳記:This example subtracts five days to the timestamp in the MM-DD-YY format:

getPastTime(5, 'Day', 'MM-DD-YY')

並傳回結果 02-26-18And returns the result 02-26-18.

範例 3Example 3

假設目前的時間戳記是 2020-05-01T00:00: 00.000 z ,而地區設定是 取消 刪除。Suppose the current timestamp is 2020-05-01T00:00:00.000Z and the locale is de-DE. 下列範例會從時間戳記減去 1 天:The example below subtracts 1 day from the timestamp:

getPastTime(1,'Day', '', 'de-DE')

並傳回結果 31.04.20 00:00:00And returns the result 31.04.20 00:00:00.

getPreviousViableDategetPreviousViableDate

根據目前日期和選擇性指定的時區,傳回 timex 運算式先前的可行日期。Return the previous viable date of a timex expression based on the current date and an optionally specified timezone.

getPreviousViableDate(<timexString>, <timezone>?)
參數Parameter 必要Required 類型Type 描述Description
<timexString><timexString> Yes 字串string 要評估之日期的 timex 字串。The timex string of the date to evaluate.
<時區><timezone> No 字串string 選用的時區。The optional timezone.
傳回值Return value 類型Type 描述Description
<previousViableDate><previousViableDate> 字串string 先前的可行日期。The previous viable date.

範例Examples

假設日期為 2020-06-12 ,而目前時間為 15:42:21Say the date is 2020-06-12 and current time is 15:42:21.

這些範例會根據上述日期和時間評估先前可行日期的 timex 字串:These examples evaluate a timex string for the previous viable date based on the above date and time:

getPreviousViableDate("XXXX-12-20", "Eastern Standard Time")
getPreviousViableDate("XXXX-02-29")

並傳回下列字串 repsectively:And return the following strings repsectively:

  • 2019-12-202019-12-20
  • 2020-02-292020-02-29

getPreviousViableTimegetPreviousViableTime

根據目前日期和選擇性指定的時區,傳回 timex 運算式的先前可用時間。Return the previous viable time of a timex expression based on the current date and an optionally specified timezone.

getPreviousViableTime(<timexString>, <timezone>?)
參數Parameter 必要Required 類型Type 描述Description
<timexString><timexString> Yes 字串string 要評估之時間的 timex 字串。The timex string of the time to evaluate.
<時區><timezone> No 字串string 選用的時區。The optional timezone.
傳回值Return value 類型Type 描述Description
<previousViableTime><previousViableTime> 字串string 先前的可行時間。The previous viable time.

範例Examples

假設日期為 2020-06-12 ,而目前時間為 15:42:21Say the date is 2020-06-12 and current time is 15:42:21.

這些範例會根據上述的日期和時間,評估先前可行時間的 timex 字串:These examples evaluate a timex string for the previous viable time based on the above date and time:

getPreviousViableTime("TXX:52:14")
getPreviousViableTime("TXX:12:14", 'Europe/London')

並傳回下列字串 repsectively:And return the following strings repsectively:

  • T14:52:14T14:52:14
  • T15:12:14T15:12:14

getPropertygetProperty

從 JSON 物件傳回指定之屬性的值或根屬性。Return the value of a specified property or the root property from a JSON object.

傳回指定之屬性的值。Return the value of a specified property

getProperty(<JSONObject>, '<propertyName>')
參數Parameter 必要Required 類型Type 描述Description
<JSONObject><JSONObject> Yes 物件 (object)object 包含屬性和值的 JSON 物件。The JSON object containing the property and values.
<propertyName><propertyName> No 字串string 要從中存取值的選擇性屬性名稱。The name of the optional property to access values from.
傳回值Return value 類型Type 描述Description
valuevalue 字串string JSON 物件中指定之屬性的值。The value of the specified property in the JSON object.

範例Example

假設您有下列 JSON 物件:Say you have the following JSON object:

{
   "a:b" : "a:b value",
   "c":
   {
        "d": "d key"
    }
}

這些範例會從上述 JSON 物件取出指定的屬性:These example retrieve a specified property from the above JSON object:

getProperty({"a:b": "value"}, 'a:b')
getProperty(c, 'd')

並分別傳回下列字串:And return the following strings respectively:

  • a:b 值a:b value
  • d 鍵d key

傳回根屬性Return the root property

getProperty('<propertyName>')
參數Parameter 必要Required 類型Type 描述Description
<propertyName><propertyName> Yes 字串string 要從根記憶體範圍存取值的選擇性屬性名稱。The name of the optional property to access values from the root memory scope.
傳回值Return value 類型Type 描述Description
valuevalue 字串string JSON 物件中根屬性的值。The value of the root property in a JSON object.

範例Example

假設您有下列 JSON 物件:Say you have the following JSON object:

{
   "a:b" : "a:b value",
   "c":
   {
        "d": "d key"
    }
}

此範例會從上述 JSON 物件中抓取根屬性:This example retrieves the root property from the above JSON object:

getProperty("a:b")

並傳回字串 a:b 值And returns the string a:b value.

getTimeOfDaygetTimeOfDay

傳回指定時間戳記的當日時間。Returns time of day for a given timestamp.

getTimeOfDay('<timestamp>')

傳回的時間是下列其中一個字串:Time returned is one of the following strings:

參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含指定時間戳記的字串The string that contains the specified timestamp
傳回值Return value 類型Type 描述Description
<time-of-day><time-of-day> 字串string 指定時間戳記的當日時間The time of day for the specified timestamp

以下列出與當日時間相關聯的字串:Listed below are the strings associated with the time of day:

當日時間Time of day 時間戳記Timestamp
midnightmidnight 12AM12AM
上午morning 12:01AM – 11:59PM12:01AM – 11:59PM
下午afternoon 12PM12PM
晚上evening 06:00PM – 10:00PM06:00PM – 10:00PM
夜間night 10:01PM – 11:59PM10:01PM – 11:59PM

範例Example

getTimeOfDay('2018-03-15T08:00:00.000Z')

傳回結果 上午Returns the result morning.

greatergreater

檢查第一個值是否大於第二個值。Check whether the first value is greater than the second value. 如果第一個值較大,則傳回 true;如果較小,則傳回 falseReturn true if the first value is more, or return false if less.

greater(<value>, <compareTo>)
greater('<value>', '<compareTo>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 整數、浮點數或字串integer, float, or string 要檢查其是否大於第二個值的第一個值The first value to check whether greater than the second value
<compareTo><compareTo> Yes 個別的整數、浮點數或字串integer, float, or string, respectively 比較值The comparison value
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果第一個值大於第二個值,則傳回 trueReturn true if the first value is greater than the second value. 如果第一個值等於或小於第二個值,則傳回 falseReturn false if the first value is equal to or less than the second value.

範例Example

以下範例會檢查第一個值是否大於第二個值:These examples check whether the first value is greater than the second value:

greater(10, 5)
greater('apple', 'banana')

並分別傳回下列結果:And return the following results respectively:

  • true
  • false

greaterOrEqualsgreaterOrEquals

檢查第一個值是否大於或等於第二個值。Check whether the first value is greater than or equal to the second value. 當第一個值較大或相等時,則傳回 true;如果第一個值較小,則傳回 falseReturn true when the first value is greater or equal, or return false if the first value is less.

greaterOrEquals(<value>, <compareTo>)
greaterOrEquals('<value>', '<compareTo>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 整數、浮點數或字串integer, float, or string 要檢查其是否大於或等於第二個值的第一個值The first value to check whether greater than or equal to the second value
<compareTo><compareTo> Yes 個別的整數、浮點數或字串integer, float, or string, respectively 比較值The comparison value
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果第一個值大於或等於第二個值,則傳回 trueReturn true if the first value is greater than or equal to the second value. 如果第一個值小於第二個值,則傳回 falseReturn false if the first value is less than the second value.

範例Example

以下範例會檢查第一個值是否大於或等於第二個值:These examples check whether the first value is greater or equal than the second value:

greaterOrEquals(5, 5)
greaterOrEquals('apple', 'banana')

並分別傳回下列結果:And return the following results respectively:

  • true
  • false

ifif

檢查運算式是 True 或 False。Check whether an expression is true or false. 根據結果,傳回指定的值。Based on the result, return a specified value.

if(<expression>, <valueIfTrue>, <valueIfFalse>)
參數Parameter 必要Required 類型Type 描述Description
<expression><expression> Yes BooleanBoolean 要檢查的運算式The expression to check
<valueIfTrue><valueIfTrue> Yes 任意any 運算式為 True 時要傳回的值The value to return if the expression is true
<valueIfFalse><valueIfFalse> Yes 任意any 運算式為 False 時要傳回的值The value to return if the expression is false
傳回值Return value 類型Type 描述Description
<specified-return-value><specified-return-value> 任意any 根據運算式為 truefalse 傳回的指定值The specified value that returns based on whether the expression is true or false

範例Example

此範例會評估 equals(1,1) 是否為 True:This example evaluates whether equals(1,1) is true:

if(equals(1, 1), 'yes', 'no')

並傳回 yes,因為指定的運算式傳回 trueAnd returns yes because the specified expression returns true. 否則,範例會傳回 noOtherwise, the example returns no.

indexOfindexOf

傳回子字串的起始位置或索引值。Return the starting position or index value of a substring. 此函式區分大小寫,而且索引從數字 0 開始。This function is case-insensitive, and indexes start with the number 0.

indexOf('<text>', '<searchText>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串或陣列string or array 具有子字串要尋找的字串The string that has the substring to find
<searchText><searchText> Yes 字串string 要尋找的子字串The substring to find
傳回值Return value 類型Type 描述Description
<index-value><index-value> integerinteger 指定子字串的起始位置或索引值。The starting position or index value of the specified substring.
如果找不到該字串,傳回數字 -1。If the string is not found, return the number -1.

範例 1Example 1

此範例會在 hello world 字串中,尋找子字串 world 的起始索引值:This example finds the starting index value of the substring world in the string hello world:

indexOf('hello world', 'world')

並傳回結果 6And returns the result 6.

範例 2Example 2

此範例會尋找 ['abc', 'def', 'ghi'] 陣列中子字串 def 的起始索引值:This example finds the starting index value of the substring def in the array ['abc', 'def', 'ghi']:

indexOf(createArray('abc', 'def', 'ghi'), 'def')

並傳回結果 1And returns the result 1.

indicesAndValuesindicesAndValues

將陣列或物件轉換成具有 index (目前的索引) 與 value 屬性的物件陣列。Turn an array or object into an array of objects with index (current index) and value properties. 針對陣列,索引是陣列中的位置。For arrays, the index is the position in the array. 針對物件,其為值的機碼。For objects, it is the key for the value.

indicesAndValues('<collection or object>')
參數Parameter 必要Required 類型Type 描述Description
<集合或物件><collection or object> Yes 陣列或物件array or object 原始陣列或物件Original array or object
傳回值Return value 類型Type 描述Description
<collection><collection> arrayarray 新陣列。New array. 每個項目都有兩個屬性:具有陣列中位置的索引或物件的機碼,以及對應的值。Each item has two properties: the index with the position in an array or the key for an object, and the corresponding value.

範例 1Example 1

假設您有清單 { items: ["zero", "one", "two"] }Say you have a list { items: ["zero", "one", "two"] }. 下列函式會接受該清單:The following function takes that list:

indicesAndValues(items)

並傳回新的清單:And returns a new list:

[
  {
    index: 0,
    value: 'zero'
  },
  {
    index: 1,
    value: 'one'
  },
  {
    index: 2,
    value: 'two'
  }
]

範例 2Example 2

假設您有清單 { items: ["zero", "one", "two"] }Say you have a list { items: ["zero", "one", "two"] }. 下列函式會接受該清單:The following function takes that list:

where(indicesAndValues(items), elt, elt.index >= 1)

並傳回新的清單:And returns a new list:

[
  {
    index: 1,
    value: 'one'
  },
  {
    index: 2,
    value: 'two'
  }
]

範例 3Example 3

假設您有清單 { items: ["zero", "one", "two"] }Say you have a list { items: ["zero", "one", "two"] }. 下列函式會接受該清單:The following function takes that list:

join(foreach(indicesAndValues(items), item, item.value), ',')

並傳回結果 zero,one,twoAnd returns the result zero,one,two. 此運算式與 join(items, ',') 的效果相同。This expression has the same effect as join(items, ',').

範例 4Example 4

假設您有物件 { user: {name: 'jack', age:20} }Say you have an object { user: {name: 'jack', age: 20} }. 下列函式會接受該物件:The following function takes that object:

indicesAndValues(user)

並傳回新的物件:And returns a new object:

[
  {
    index: 'name',
    value: 'jack'
  },
  {
    index: 'age',
    value: 20
  }
]

intint

傳回字串的整數版本。Return the integer version of a string. 如果字串無法轉換成整數,則會擲回例外狀況。An exception will be thrown if the string cannot be converted to an integer.

int('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換的字串The string to convert
傳回值Return value 類型Type 描述Description
<integer-result><integer-result> integerinteger 指定字串的整數版本The integer version of the specified string

範例Example

此範例會建立字串 10 的整數版本:This example creates an integer version for the string 10:

int('10')

並傳回整數 10 的結果。And returns the result as the integer 10.

交集intersection

在指定的多個集合中,傳回只有共同項目的集合。Return a collection that has only the common items across the specified collections. 項目若要出現在結果中,必須出現在所有傳遞至此函式的集合中。To appear in the result, an item must appear in all the collections passed to this function. 如果一個或多個項目有相同的名稱,則具有該名稱的最後一個項目會出現在結果中。If one or more items have the same name, the last item with that name appears in the result.

intersection([<collection1>], [<collection2>], ...)
intersection('<collection1>', '<collection2>', ...)
參數Parameter 必要Required 類型Type 描述Description
<collection1>, <collection2><collection1>, <collection2> Yes 陣列或物件,但不可以兩者並存array or object, but not both 您想要其中只有共同項目的集合The collections from which you want only the common items
傳回值Return value 類型Type 描述Description
<common-items><common-items> 個別的陣列或物件array or object, respectively 在指定的多個集合中,「只有」共同項目的集合A collection that has only the common items across the specified collections

範例Example

此範例會從下列陣列中找出共同項目:This example finds the common items across the following arrays:

intersection(createArray(1, 2, 3), createArray(101, 2, 1, 10), createArray(6, 8, 1, 2))

並傳回只有項目 [1, 2] 的陣列。And returns an array with only the items [1, 2].

isArrayisArray

如果指定的輸入為陣列,則傳回 trueReturn true if a given input is an array.

isArray('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的輸入為陣列,則傳回 true;如果不是陣列,則傳回 falseReturn true if a given input is an array, or return false if it is not an array.

範例Examples

下列範例會檢查輸入是否為陣列:The following examples check if the input is an array:

isArray('hello')
isArray(createArray('hello', 'world'))

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 falseThe input is a string, so the function returns false.
  • 輸入為陣列,因此函式傳回 trueThe input is an array, so the function returns true.

isBooleanisBoolean

如果指定的輸入為布林值,則傳回 trueReturn true if a given input is a Boolean.

isBoolean('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的輸入是布林值,則傳回 true;如果不是布林值,則傳回 falseReturn true if a given input is a Boolean, or return false if it not a Boolean.

範例Examples

下列範例會檢查輸入是否為布林值:The following examples check if the input is a Boolean:

isBoolean('hello')
isBoolean(32 > 16)

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 falseThe input is a string, so the function returns false.
  • 輸入為布林值,因此函式傳回 trueThe input is a Boolean, so the function returns true.

isDateisDate

如果指定的 TimexProperty 或 Timex 運算式參考有效的日期,則傳回 trueReturn true if a given TimexProperty or Timex expression refers to a valid date. 有效的日期包含 month 與 dayOfMonth,或包含 dayOfWeek。Valid dates contain the month and dayOfMonth, or contain the dayOfWeek.

isDate('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串bbject or string 輸入 TimexProperty 物件或 Timex 運算式字串。The input TimexProperty object or a Timex expression string.
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果輸入參考有效的日期,則傳回 true;如果日期無效,則傳回 falseReturn true if the input refers to a valid date, or return false if the date is invalid.

範例Examples

這些範例會檢查下列輸入是否為有效的日期:These examples check if the following inputs are valid dates:

isDate('2020-12')
isDate('xxxx-12-21')

並傳回下列結果:And return the following results:

  • false
  • true

isDateRangeisDateRange

如果指定的 TimexProperty 或 Timex 運算式參考有效的日期範圍,則傳回 trueReturn true if a given TimexProperty or Timex expression refers to a valid date range.

isDateRange('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串object or string 輸入 TimexProperty 物件或 Timex 運算式字串。The input TimexProperty object a Timex expression string.
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果指定的輸入參考有效的日期範圍,則傳回 true;如果不是有效的日期範圍,則傳回 falseReturn true if given input refers to a valid date range, or return false if it is not a valid date range.

範例Examples

這些範例會檢查下列輸入是否為有效的日期範圍:These examples check if the following input is a valid date range:

isDateRange('PT30M')
isDateRange('2012-02')

並傳回下列結果:And return the following results:

  • false
  • true

isDateTimeisDateTime

如果指定的輸入為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ) 時間戳記字串,則傳回 trueReturn true if a given input is a UTC ISO format (YYYY-MM-DDTHH:mm:ss.fffZ) timestamp string.

isDateTime('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的輸入是 UTC ISO 格式時間戳記字串,則傳回 true;如果不是 UTC ISO 格式時間戳記字串,則傳回 falseReturn true if a given input is a UTC ISO format timestamp string, or return false if it is not a UTC ISO format timestamp string.

範例Examples

下列範例會檢查輸入是否為 UTC ISO 格式字串:The following examples check if the input is a UTC ISO format string:

isDateTime('hello world!')
isDateTime('2019-03-01T00:00:00.000Z')

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 falseThe input is a string, so the function returns false.
  • 輸入為 UTC ISO 格式字串,因此函式傳回 trueThe input is a UTC ISO format string, so the function returns true.

isDefiniteisDefinite

如果指定的 TimexProperty 或 Timex 運算式參考有效的日期,則傳回 trueReturn true if a given TimexProperty or Timex expression refers to a valid date. 有效的日期包含 year、month 與 dayOfMonth。Valid dates contain the year, month and dayOfMonth.

isDefinite('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串object or string 輸入 TimexProperty 物件或 Timex 運算式字串。The input TimexProperty object a Timex expression string.
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果指定的輸入參考有效的完整日期,則傳回 true;如果未參考有效的完整日期,則傳回 falseReturn true if the given input refers to a valid full date, or return false if it does not refere to a valid full date.

範例Examples

假設有一個 TimexProperty 物件 validFullDate = new TimexProperty("2020-02-20") ,且 Now 屬性設定為 trueSuppose there is a TimexProperty object validFullDate = new TimexProperty("2020-02-20") and the Now property is set to true. 下列範例會檢查物件是否參考有效的完整日期:The following examples check if the object refers a valid full date:

isDefinite('xxxx-12-21')
isDefinite(validFullDate)

並分別傳回下列結果:And return the following results respectively:

  • false
  • true

isDurationisDuration

如果指定的 TimexProperty 或 Timex 運算式參考有效的持續時間,則傳回 trueReturn true if a given TimexProperty or Timex expression refers to a valid duration.

isDuration('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串object or string 輸入 TimexProperty 物件或 Timex 運算式字串。The input TimexProperty object a Timex expression string.
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果輸入參考有效的持續時間,則傳回 true;如果輸入未參考有效的持續時間,則傳回 falseReturn true if the input refers to a valid duration, or return false if the input doesn't refer to a valid duration.

範例Examples

下列範例會檢查下列輸入是否參考有效的持續時間:The examples below check if the following input refers to a valid duration:

isDuration('PT30M')
isDuration('2012-02')

並分別傳回下列結果:And return the following results respectively:

  • true
  • false

isFloatisFloat

如果指定的輸入是浮點數,則傳回 trueReturn true if a given input is a floating-point number. 由於 C# 與 JavaScript 之間的對齊方式,其模數 1 殘差為非零的數字將會視為浮點數。Due to the alignment between C#and JavaScript, a number with an non-zero residue of its modulo 1 will be treated as a floating-point number.

isFloat('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的輸入為浮點數,則傳回 true;如果輸入不是浮點數,則傳回 falseReturn true if a given input is a floating-point number, or return false if the input is not a floating-point number.

範例Examples

下列範例會檢查輸入是否為浮點數:The following examples check if the input is a floating-point number:

isFloat('hello world!')
isFloat(1.0)
isFloat(12.01)

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 falseThe input is a string, so the function returns false.
  • 輸入的模數等於 0,因此函式會傳回 falseThe input has a modulo that equals 0, so the function returns false.
  • 輸入是浮點數,因此函式會傳回 trueThe input is a floating-point number, so the function returns true.

isIntegerisInteger

如果指定的輸入是整數,則傳回 trueReturn true if a given input is an integer number. 由於 C# 與 JavaScript 之間的對齊方式,其模數 1 殘差為零的數字將會視為整數。Due to the alignment between C# and JavaScript, a number with an zero residue of its modulo 1 will be treated as an integer number.

isInteger('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 輸入是否為整數Is the input is an integer number

範例Examples

下列範例會檢查輸入是否為整數:The following examples check if the input is an integer:

isInteger('hello world!')
isInteger(1.0)
isInteger(12)

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 falseThe input is a string, so the function returns false.
  • 輸入的模數等於 0,因此函式會傳回 trueThe input has a modulo that equals 0, so the function returns true.
  • 輸入為整數,因此函式傳回 trueThe input is an integer, so the function returns true.

isMatchisMatch

如果指定的字串符合指定的規則運算式模式,則傳回 trueReturn true if a given string is matches a specified regular expression pattern.

isMatch('<target**string>', '<pattern>')
參數Parameter 必要Required 類型Type 描述Description
<target**string><target**string> Yes 字串string 要比對的字串The string to be matched
<pattern><pattern> Yes 字串string 規則運算式模式A regular expression pattern
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的字串符合一般規則運算式模式,則傳回 true;如果不符合模式,則傳回 falseReturn true if a given string is matches a common regular expression pattern, or return false if it does not match the pattern.

範例Examples

下列範例會檢查輸入是否符合指定的規則運算式模式:The following examples check if the input matches the specified regular expression pattern:

isMatch('ab', '^[a-z]{1,2}$')
isMatch('FUTURE', '(?i)fortune|future')
isMatch('12abc34', '([0-9]+)([a-z]+)([0-9]+)')
isMatch('abacaxc', 'ab.*?c')

並傳回相同的結果 trueAnd return the same result true.

isObjectisObject

如果指定的輸入為複雜物件,則傳回 true;如果是基本物件,則傳回 falseReturn true if a given input is a complex object or return false if it is a primitive object. 基本物件包括字串、數字與布林值;複雜類型 (例如類別) 包含屬性。Primitive objects include strings, numbers, and Booleans; complex types, like classes, contain properties.

isObject('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的輸入為複雜物件,則傳回 true;如果是基本物件,則傳回 falseReturn true if a given input is a complex object, or return false if it is a primitive object.

範例Examples

下列範例會檢查指定的輸入是否為物件:The following examples check if the given input is an object:

isObject('hello world!')
isObject({userName: "Sam"})

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 falseThe input is a string, so the function returns false.
  • 輸入為物件,因此函式傳回 trueThe input is an object, so the function returns true.

isPresentisPresent

如果指定的 TimexProperty 或 Timex 運算式參考現在,則傳回 trueReturn true if a given TimexProperty or Timex expression refers to the present.

isPresent('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串object or string 輸入 TimexProperty 物件或 Timex 運算式字串The input TimexProperty object a Timex expression string
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果輸入參考現在,則傳回 true;如果未參考現在,則傳回 False。Return true if the input refers to the present, or return false if it doesn't refere to the present.

範例 假設我們有一個 TimexProperty 物件 validNow = new TimexProperty() { Now = true } ,並將 Now 屬性設定為 trueExamples Suppose we have an TimexProperty object validNow = new TimexProperty() { Now = true } and set the Now property to true. 下列範例會檢查下列輸入是否參考現在:The examples below check if the following input refers to the present:

isPresent('PT30M')
isPresent(validNow)

並分別傳回下列結果:And return the following results respectively:

  • false
  • true

isStringisString

如果指定的輸入為字串,則傳回 trueReturn true if a given input is a string.

isString('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 任意any 要測試的輸入The input to be tested
傳回值Return value 類型Type 描述Description
<Boolean-result><Boolean-result> BooleanBoolean 如果指定的輸入為字串,則傳回 true;如果不是字串,則傳回 falseReturn true if a given input is a string, or return false if not a string.

範例Examples

下列範例會檢查指定的輸入是否為字串:The following examples check if the given input is a string:

isString('hello world!')
isString(3.14)

並分別傳回下列結果:And return the following results respectively:

  • 輸入為字串,因此函式傳回 trueThe input is a string, so the function returns true.
  • 輸入為浮點數,因此函式傳回 falseThe input is a float, so the function returns false.

isTimeisTime

如果指定的 TimexProperty 或 Timex 運算式參考有效的日期,則傳回 trueReturn true if a given TimexProperty or Timex expression refers to a valid time. 有效時間包含小時、分鐘與秒。Valid time contains hours, minutes and seconds.

isTime('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串object or string 輸入 TimexProperty 物件或 Timex 運算式字串The input TimexProperty object a Timex expression string
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果輸入參考有效的時間,則傳回 true;如果未參考有效的時間,則傳回 falseReturn true if the input refers to a valid time, or return false if it doesn't refer to a valid time..

範例Examples

這些範例會檢查下列輸入是否參考有效的時間:These examples check if the following input referes to a valid time:

isTime('PT30M')
isTime('2012-02-21T12:30:45')

並分別傳回下列結果:And return the following results respectively:

  • false
  • true

isTimeRangeisTimeRange

如果指定的 TimexProperty 或 Timex 運算式參考有效的時間範圍 (有效的時間範圍包含 partOfDay),則傳回 trueReturn true if a given TimexProperty or Timex expression refers to a valid time range Valid time ranges contain partOfDay.

isTime('<input>')
參數Parameter 必要Required 類型Type 描述Description
<input><input> Yes 物件或字串object or string 輸入 TimexProperty 物件或 Timex 運算式字串。The input TimexProperty object a Timex expression string.
傳回值Return value 類型Type 描述Description
<boolean-result><boolean-result> BooleanBoolean 如果輸入參考有效的時間範圍,則傳回 true;如果未參考有效的時間範圍,則傳回 falseReturn true if the input refers to a valid time range, or return false if it doesn't refer to a valid time range.

範例Examples

假設我們有一個 TimexProperty 物件 validTimeRange = new TimexProperty() { PartOfDay = "morning" } ,並將 Now 屬性設定為 trueSuppose we have an TimexProperty object validTimeRange = new TimexProperty() { PartOfDay = "morning" } and set the Now property to true. 這些範例會檢查下列輸入是否為有效的時間範圍:These examples check if the following inputs are valid time ranges:

isTimeRange('PT30M')
isTimeRange(validTimeRange)

並分別傳回下列結果:And return the following results respectively:

  • false
  • true

Joinjoin

傳回具有陣列中所有項目的字串,並以「分隔符號」將每個字元隔開。Return a string that has all the items from an array, with each character separated by a delimiter.

join([<collection>], '<delimiter>')
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes arrayarray 要將其項目聯結的陣列The array that has the items to join
<delimiter><delimiter> Yes 字串string 在結果字串中,要出現在每個字元之間的分隔符號The separator that appears between each character in the resulting string
傳回值Return value 類型Type 描述Description
<char1><delimiter><char2><delimiter>...<char1><delimiter><char2><delimiter>... 字串string 從指定陣列中所有項目建立的結果字串The resulting string created from all the items in the specified array

範例Example

此範例會從此陣列中所有項目建立字串,並以指定字元 .This example creates a string from all the items in this array with the specified character . 作為分隔符號:as the delimiter:

join(createArray('a', 'b', 'c'), '.')

並傳回結果 a.b.cAnd returns the result a.b.c.

jPathjPath

檢查 JSON 或 JSON 字串中是否有符合路徑運算式的節點或值,並傳回相符的節點。Check JSON or a JSON string for nodes or values that match a path expression, and return the matching nodes.

jPath(<json>, '<path>')
參數Parameter 必要Required 類型Type 描述Description
<json><json> Yes 任意any JSON 物件或字串,將對其搜尋是否有符合 path 運算式值的節點或值The JSON object or string to search for nodes or values that match the path expression value
<path><path> Yes 任意any 用來尋找相符 JSON 節點或值的 path 運算式The path expression used to find matching JSONnodes or values
傳回值Return value 類型Type 描述Description
[ <json-node>][ <json-node>] arrayarray 符合指定 path 運算式的 JSON 節點或值的清單An list of JSON nodes or value that matches the specified path expression

C# 範例C# Example

假設您有下列 JSON:Say you have the following JSON:

{
    "Stores": [
        "Lambton Quay",
        "Willis Street"
    ],
    "Manufacturers": [
        {
            "Name": "Acme Co",
            "Products": [
                {
                    "Name": "Anvil",
                    "Price": 50
                }
            ]
        },
        {
            "Name": "Contoso",
            "Products": [
                {
                    "Name": "Elbow Grease",
                    "Price": 99.95
                },
                {
                    "Name": "Headlight Fluid",
                    "Price": 4
                }
            ]
        }
    ]
}

path 運算式為 $..Products[?(@.Price >= 50)].NameThe path expression is $..Products[?(@.Price >= 50)].Name

jPath(jsonStr, path)

且其會傳回 ["Anvil", "Elbow Grease"] 的結果。And it returns the result ["Anvil", "Elbow Grease"].

JavaScript 範例Javascript Example

假設您有下列 JSON:Say you have the following JSON:

{
    "automobiles": [
        {
            "maker": "Nissan",
            "model": "Teana",
            "year": 2011
        },
        {
            "maker": "Honda",
            "model": "Jazz",
            "year": 2010
        },
        {
            "maker": "Honda",
            "model": "Civic",
            "year": 2007
        },
        {
            "maker": "Toyota",
            "model": "Yaris",
            "year": 2008
        },
        {
            "maker": "Honda",
            "model": "Accord",
            "year": 2011
        }
    ],
    "motorcycles": [
        {
            "maker": "Honda",
            "model": "ST1300",
            "year": 2012
        }
    ]
}

path 運算式為 .automobiles{.maker === "Honda" && .year > 2009}.modelThe path expression is .automobiles{.maker === "Honda" && .year > 2009}.model.

jPath(jsonStr, path)

且其會傳回 ['Jazz', 'Accord']And it returns the result ['Jazz', 'Accord'].

jsonjson

傳回字串或 XML 的 JavaScript 物件標記法 (JSON) 類型值或物件。Return the JavaScript Object Notation (JSON) type value or object of a string or XML.

json('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串或 XMLstring or XML 要轉換的字串或 XMLThe string or XML to convert
傳回值Return value 類型Type 描述Description
<JSON-result><JSON-result> 字串string 從指定的字串或 XML 建立的結果 JSON 物件。The resulting JSON object created from the specified string or XML.

範例 1Example 1

此範例會將字串轉換成 JSON:This example converts a string to JSON:

json('{"fullName": "Sophia Owen"}')

並傳回結果:And returns the result:

{
  "fullName": "Sophia Owen"
}

範例 2Example 2

此範例會將 XML 轉換成 JSON:This example converts XML to JSON:

json(xml('<?xml version="1.0"?> <root> <person id='1'> <name>Sophia Owen</name> <occupation>Engineer</occupation> </person> </root>'))

並傳回結果:And returns the result:

{
   "?xml": { "@version": "1.0" },
   "root": {
      "person": [ {
         "@id": "1",
         "name": "Sophia Owen",
         "occupation": "Engineer"
      } ]
   }
}

lastlast

傳回集合中的最後一個項目。Return the last item from a collection.

last('<collection>')
last([<collection>])
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串或陣列string or array 要從中尋找最後一個項目的集合The collection in which to find the last item
傳回值Return value 類型Type 描述Description
<last-collection-item><last-collection-item> 個別的字串或陣列string or array, respectively 集合中的最後一個項目The last item in the collection

範例Example

這些範例會尋找以下集合中最後一個項目:These examples find the last item in these collections:

last('abcd')
last(createArray(0, 1, 2, 3))

並分別傳回下列結果:And returns the following results respectively:

  • dd
  • 33

lastIndexOflastIndexOf

傳回 substring 最後一次出現的起始位置或索引值。Return the starting position or index value of the last occurrence of a substring. 此函式區分大小寫,而且索引從數字 0 開始。This function is case-insensitive, and indexes start with the number 0.

lastIndexOf('<text>', '<searchText>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串或陣列string or array 具有子字串要尋找的字串The string that has the substring to find
<searchText><searchText> Yes 字串string 要尋找的子字串The substring to find
傳回值Return value 類型Type 描述Description
<ending-index-value><ending-index-value> integerinteger 指定的子字串最後一次出現的起始位置或索引值。The starting position or index value of the last occurrence of the specified substring. 如果找不到該字串,則傳回數字 -1If the string is not found, return the number -1.

範例 1Example 1

此範例會在 hello world 字串中,尋找子字串 world 最後一次出現的起始索引值:This example finds the starting index value of the last occurrence of the substring world in the hello world string:

lastIndexOf('hello world', 'world')

並傳回結果 6And returns the result 6.

範例 2Example 2

此範例會在 ['abc', 'def', 'ghi', 'def'] 陣列中尋找子字串 def 最後一次出現的起始索引值。This example finds the starting index value of the last occurrence of substring def in the array ['abc', 'def', 'ghi', 'def'].

lastIndexOf(createArray('abc', 'def', 'ghi', 'def'), 'def')

並傳回結果 3And returns the result 3.

長度length

傳回字串的長度。Return the length of a string.

length('<str>')
參數Parameter 必要Required 類型Type 描述Description
<str><str> Yes 字串string 要計算長度的字串The string to calculate for length
傳回值Return value 類型Type 描述Description
<length><length> integerinteger 此字串的長度The length of this string

範例Examples

這些範例會取得字串的長度:These examples get the length of strings:

length('hello')
length('hello world')

並分別傳回下列結果:And returns the following results respectively:

  • 55
  • 1111

lessless

檢查第一個值是否小於第二個值。Check whether the first value is less than the second value. 如果第一個值較小,則傳回 true;如果較大,則傳回 falseReturn true if the first value is less, or return false if the first value is more.

less(<value>, <compareTo>)
less('<value>', '<compareTo>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 整數、浮點數或字串integer, float, or string 要檢查其是否小於第二個值的第一個值The first value to check whether less than the second value
<compareTo><compareTo> Yes 個別的整數、浮點數或字串integer, float, or string, respectively 比較項目The comparison item
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果第一個值小於第二個值,則傳回 trueReturn true if the first value is less than the second value. 如果第一個值等於或大於第二個值,則傳回 falseReturn false if the first value is equal to or greater than the second value.

範例Examples

以下範例會檢查第一個值是否小於第二個值。These examples check whether the first value is less than the second value.

less(5, 10)
less('banana', 'apple')

並分別傳回下列結果:And return the following results respectively:

  • true
  • false

lessOrEqualslessOrEquals

檢查第一個值是否小於或等於第二個值。Check whether the first value is less than or equal to the second value. 如果第一個值較小或相等,則傳回 true;如果較大,則傳回 falseReturn true if the first value is less than or equal, or return false if the first value is more.

lessOrEquals(<value>, <compareTo>)
lessOrEquals('<value>', '<compareTo>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 整數、浮點數或字串integer, float, or string 要檢查其是否小於或等於第二個值的第一個值The first value to check whether less than or equal to the second value
<compareTo><compareTo> Yes 個別的整數、浮點數或字串integer, float, or string, respectively 比較項目The comparison item
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果第一個值小於或等於第二個值,則傳回 trueReturn true if the first value is less than or equal to the second value. 如果第一個值大於第二個值,則傳回 falseReturn false if the first value is greater than the second value.

範例Example

這些範例會檢查第一個值是否小於或等於第二個值。These examples check whether the first value is less than or equal to the second value.

lessOrEquals(10, 10)
lessOrEquals('apply', 'apple')

並分別傳回下列結果:And return the following results respectively:

  • true
  • false

maxmax

傳回清單或陣列中的最大值。Return the highest value from a list or array. 清單或陣列的兩端都包含在內。The list or arary is inclusive at both ends.

max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])
參數Parameter 必要Required 類型Type 描述Description
<number1>, <number2>, ...<number1>, <number2>, ... Yes numbernumber 您需要其中最大值的數字集合The set of numbers from which you want the highest value
[<number1>, <number2>, ...][<number1>, <number2>, ...] Yes 數字陣列array of numbers 您需要其中最大值的數字陣列The array of numbers from which you want the highest value
傳回值Return value 類型Type 描述Description
<max-value><max-value> numbernumber 所指定陣列或數字集合中的最大值The highest value in the specified array or set of numbers

範例Examples

這些範例會從數字集合和陣列中取得最大值:These examples get the highest value from the set of numbers and the array:

max(1, 2, 3)
max(createArray(1, 2, 3))

並傳回結果 3And return the result 3.

Minmin

從數字集合或陣列中傳回最小值。Return the lowest value from a set of numbers or an array.

min(<number1>, <number2>, ...)
min([<number1>, <number2>, ...])
參數Parameter 必要Required 類型Type 描述Description
<number1>, <number2>, ...<number1>, <number2>, ... Yes numbernumber 您需要其中最小值的數字集合The set of numbers from which you want the lowest value
[<number1>, <number2>, ...][<number1>, <number2>, ...] Yes 數字陣列array of numbers 您需要其中最小值的數字陣列The array of numbers from which you want the lowest value
傳回值Return value 類型Type 描述Description
<min-value><min-value> numbernumber 指定陣列或數字集合中的最小值The lowest value in the specified array or set of numbers

範例Examples

這些範例會取得數字集合和陣列中的最小值:These examples get the lowest value in the set of numbers and the array:

min(1, 2, 3)
min(createArray(1, 2, 3))

並傳回結果 1And return the result 1.

modmod

傳回兩數相除的餘數。Return the remainder from dividing two numbers. 若要取得整數結果,請參閱 div()To get the integer result, see div().

mod(<dividend>, <divisor>)
參數Parameter 必要Required 類型Type 描述Description
<dividend><dividend> Yes numbernumber 要除以「除數」的數字The number to divide by the divisor
<divisor><divisor> Yes numbernumber 要除「被除數」的數字。The number that divides the dividend. 不能為 0。Cannot be 0.
傳回值Return value 類型Type 描述Description
<modulo-result><modulo-result> numbernumber 第一個數字除以第二個數字的餘數The remainder from dividing the first number by the second number

範例Example

此範例會將第一個數字除以第二個數字:This example divides the first number by the second number:

mod(3, 2)

並傳回結果 1And returns the result 1.

month

傳回指定時間戳記的月份。Return the month of the specified timestamp.

month('<timestamp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
傳回值Return value 類型Type 描述Description
<number-of-month><number-of-month> integerinteger 指定時間戳記中的月數The number of the month in the specified timestamp

範例Example

month('2018-03-15T13:01:00.000Z')

且其傳回結果 3And it returns the result 3.

mulmul

傳回將兩數相乘的乘積。Return the product from multiplying two numbers.

mul(<multiplicand1>, <multiplicand2>)
參數Parameter 必要Required 類型Type 描述Description
<multiplicand1><multiplicand1> Yes 整數或浮點數integer or float 要與「被乘數 2」 相乘的數字The number to multiply by multiplicand2
<multiplicand2><multiplicand2> Yes 整數或浮點數integer or float 要與「被乘數 1」 相乘的數字The number that multiples multiplicand1
傳回值Return value 類型Type 描述Description
<product-result><product-result> 整數或浮點數integer or float 第一個數字與第二個數字相乘的乘積The product from multiplying the first number by the second number

範例Examples

這些範例會將第一個數字與第二個數字相乘:These examples multiple the first number by the second number:

mul(1, 2)
mul(1.5, 2)

並分別傳回下列結果:And return the following results respectively:

  • 22
  • 33

newGuidnewGuid

傳回新的 Guid 字串。Return a new Guid string.

newGuid()
傳回值Return value 類型Type 描述Description
<Guid-string><Guid-string> 字串string 新的 Guid 字串,長度為 36,且看起來像 xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxxA new Guid string, length is 36 and looks like xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx

範例Example

newGuid()

且其會傳回結果,格式為 xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxxAnd it returns a result which follows the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.

not

檢查運算式是否為 False。Check whether an expression is false. 如果運算式為 False,則傳回 true;如果為 True,則傳回 falseReturn true if the expression is false, or return false if true.

not(<expression>)
參數Parameter 必要Required 類型Type 描述Description
<expression><expression> Yes BooleanBoolean 要檢查的運算式The expression to check
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果運算式為 False,則傳回 trueReturn true if the expression is false. 如果運算式為 True,則傳回 falseReturn false if the expression is true.

範例 1Example 1

這些範例會檢查指定的運算式是否為 False:These examples check whether the specified expressions are false:

not(false)
not(true)

並分別傳回下列結果:And return the following results respectively:

  • 運算式為 False,所以函數傳回 trueThe expression is false, so the function returns true.
  • 運算式為 True,所以函數傳回 falseThe expression is true, so the function returns false.

範例 2Example 2

這些範例會檢查指定的運算式是否為 False:These examples check whether the specified expressions are false:

not(equals(1, 2))
not(equals(1, 1))

並分別傳回下列結果:And return the following results respectively:

  • 運算式為 False,所以函數傳回 trueThe expression is false, so the function returns true.
  • 運算式為 True,所以函數傳回 falseThe expression is true, so the function returns false.

or

檢查是否至少有一個運算式是 True。Check whether at least one expression is true. 如果至少有一個運算式為 True,則傳回 true;如果全部為 False,則傳回 falseReturn true if at least one expression is true, or return false if all are false.

or(<expression1>, <expression2>, ...)
參數Parameter 必要Required 類型Type 描述Description
<expression1>, <expression2>, ...<expression1>, <expression2>, ... Yes BooleanBoolean 要檢查的運算式The expressions to check
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果至少一個運算式為 True,則傳回 trueReturn true if at least one expression is true. 如果所有運算式都為 False,則傳回 falseReturn false if all expressions are false.

範例 1Example 1

這些範例會檢查是否至少有一個運算式是 True:These examples check whether at least one expression is true:

or(true, false)
or(false, false)

並分別傳回下列結果:And return the following results respectively:

  • 至少有一個運算式為 True,所以函數傳回 trueAt least one expression is true, so the function returns true.
  • 兩個運算式都是 False,所以函式傳回 falseBoth expressions are false, so the function returns false.

範例 2Example 2

這些範例會檢查是否至少有一個運算式是 True:These examples check whether at least one expression is true:

or(equals(1, 1), equals(1, 2))
or(equals(1, 2), equals(1, 3))

並分別傳回下列結果:And return the following results respectively:

  • 至少有一個運算式為 True,所以函數傳回 trueAt least one expression is true, so the function returns true.
  • 兩個運算式都是 False,所以函式傳回 falseBoth expressions are false, so the function returns false.

randrand

從指定範圍傳回隨機整數 (不包含範圍中的末端數字)。Return a random integer from a specified range, which is inclusive only at the starting end.

rand(<minValue>, <maxValue>)
參數Parameter 必要Required 類型Type 描述Description
<minValue><minValue> Yes integerinteger 範圍中的最小整數The lowest integer in the range
<maxValue><maxValue> Yes integerinteger 在範圍中,在函式所能傳回最大整數後面的整數The integer that follows the highest integer in the range that the function can return
傳回值Return value 類型Type 描述Description
<random-result><random-result> integerinteger 從指定範圍傳回的隨機整數The random integer returned from the specified range

範例Example

此範例會從指定範圍取得隨機整數,但不包含最大值:This example gets a random integer from the specified range, excluding the maximum value:

rand(1, 5)

並傳回結果 1234And returns 1, 2, 3, or 4 as the result.

rangerange

傳回從指定整數開始的整數陣列。Return an integer array that starts from a specified integer.

range(<startIndex>, <count>)
參數Parameter 必要Required 類型Type 描述Description
<startIndex><startIndex> Yes integerinteger 作為第一個項目起始陣列的整數值An integer value that starts the array as the first item
<count><count> Yes integerinteger 陣列中的整數數量The number of integers in the array
傳回值Return value 類型Type 描述Description
<range-result><range-result> integerinteger 從指定索引開始的整數陣列The array with integers starting from the specified index

範例Example

此範例會建立從指定索引 1 開始的整數陣列,且其中有指定數量的整數,例如 4This example creates an integer array that starts from the specified index 1 and has the specified number of integers as 4:

range(1, 4)

並傳回結果 [1, 2, 3, 4]And returns the result [1, 2, 3, 4].

removePropertyremoveProperty

從物件中移除屬性,並傳回更新的物件。Remove a property from an object and return the updated object.

removeProperty(<object>, '<property>')
參數Parameter 必要Required 類型Type 描述Description
<object><object> Yes 物件 (object)object 您要從中移除屬性的 JSON 物件The JSON object in which you want to remove a property
<property><property> Yes 字串string 要移除之屬性的名稱The name of the property to remove
傳回值Return value 類型Type 描述Description
<updated-object><updated-object> 物件 (object)object 沒有指定屬性的更新 JSON 物件The updated JSON object without the specified property

範例Example

此範例會從以 json() 函式轉換成 JSON 的 customerProfile 物件中移除 accountLocation 屬性,並傳回更新的物件:This example removes the accountLocation property from a customerProfile object, which is converted to JSON with the json() function, and returns the updated object:

removeProperty(json('customerProfile'), 'accountLocation')

取代replace

使用指定字串取代子字串,並傳回結果字串。Replace a substring with the specified string, and return the result string. 此函式會區分大小寫。This function is case-sensitive.

replace('<text>', '<oldText>', '<newText>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 有子字串要取代的字串The string that has the substring to replace
<oldText><oldText> Yes 字串string 要取代的子字串The substring to replace
<newText><newText> Yes 字串string 取代字串The replacement string
傳回值Return value 類型Type 描述Description
<updated-text><updated-text> 字串string 取代子字串後的更新字串。The updated string after replacing the substring. 如果找不到子字串,則函式會傳回原始字串。If the substring is not found, the function returns the original string.

範例 1Example 1

此範例會尋找 the old string 中的子字串 old,然後以 new 取代 oldThis example finds the substring old in the old string and replaces old with new:

replace('the old string', 'old', 'new')

結果是字串 the new stringThe result is the string the new string.

範例 2Example 2

處理逸出字元時,運算式引擎也會為您處理非逸出字元。When dealing with escape characters, the expression engine handles the unescape for you. 此函式會以逸出字元取代字串。This function replaces strings with escape characters.

replace('hello\"', '\"', '\n')
replace('hello\n', '\n', '\\\\')
@"replace('hello\\', '\\', '\\\\')"
@"replace('hello\n', '\n', '\\\\')"

並分別傳回下列結果:And returns the following results respectively:

  • hello\nhello\n
  • hello\\hello\\
  • @"hello\\"@"hello\\"
  • @"hello\\"@"hello\\"

replaceIgnoreCasereplaceIgnoreCase

使用指定字串取代子字串,並傳回結果字串。Replace a substring with the specified string, and return the result string. 此函式區分大小寫。This function is case-insensitive.

replaceIgnoreCase('<text>', '<oldText>', '<newText>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 有子字串要取代的字串The string that has the substring to replace
<oldText><oldText> Yes 字串string 要取代的子字串The substring to replace
<newText><newText> Yes 字串string 取代字串The replacement string
傳回值Return value 類型Type 描述Description
<updated-text><updated-text> 字串string 取代子字串後的更新字串。The updated string after replacing the substring. 如果找不到子字串,則傳回原始字串。If the substring is not found, return the original string.

範例Example

此範例會尋找 the old string 中的子字串 old,然後以 new 取代 oldThis example finds the substring old in the string the old string and replaces old with new:

replace('the old string', 'old', 'new')

並傳回結果 the new stringAnd returns the result the new string.

roundround

將值四捨五入到最接近的整數或指定的小數位數。Round a value to the nearest integer or to the specified number of fractional digits.

round('<number>', '<precision-digits>')
參數Parameter 必要Required 類型Type 描述Description
<number><number> Yes numbernumber 輸入編號An input number
<有效位數-數位><precision-digits> No integerinteger 指定的小數位數。A specified number of fractional digits. 預設值是 0。The default is 0.
傳回值Return value 類型Type 描述Description
<傳回值><return-value> numbernumber 以指定的小數位數四捨五入的輸入值。The return value of the input rounded at a specified number of fractional digits

範例 1Example 1

此範例會將數位 10.333 四捨五入:This example rounds the number 10.333:

round(10.333)

並傳回數位 10And returns the number 10.

範例 2Example 2

此範例會將數位 10.3313 四捨五入為 2 個小數位數:This example rounds the number 10.3313 to 2 fractional digits:

round(10.3313, 2)

並傳回數位 10.33And returns the number 10.33.

selectselect

在每個元素上操作,並傳回已轉換元素的新集合。Operate on each element and return the new collection of transformed elements.

select([<collection/instance>], <iteratorName>, <function>)
參數Parameter 必要Required 類型Type 描述Description
<collection/instance><collection/instance> Yes arrayarray 包含項目的集合The collection with the items
<iteratorName><iteratorName> Yes 迭代器名稱iterator name 金鑰專案The key item
<function><function> Yes expressionexpression 包含 iteratorName 的函式Th function that can contains iteratorName
傳回值Return value 類型Type 描述Description
<new-collection><new-collection> arrayarray 新的集合,其中每個元素都已使用函式進行評估The new collection in which each element has been evaluated with the function

範例 1Example 1

此範例會產生新的集合:This example generates a new collection:

select(createArray(0, 1, 2, 3), x, x + 1)

並傳回結果 [1, 2, 3, 4]And returns the result [1, 2, 3, 4].

範例 2Example 2

這些範例會產生新的集合:These examples generate a new collection:

select(json("{'name': 'jack', 'age': '15'}"), x, concat(x.key, ':', x.value))
select(json("{'name': 'jack', 'age': '15'}"), x=> concat(x.key, ':', x.value))

並傳回結果 [' name:插口 ',' age: 15 ']And return the result ['name:jack', 'age:15']. 請注意,第二個運算式是 lambda 運算式,可讓您找到更容易讀取的運算式。Note that the second expression is a lambda expression, which some find more readable.

sentenceCasesentenceCase

使用選擇性的地區設定格式,將字串中第一個單字的第一個字母大寫。Capitalize the first letter of the first word in a string in an optional locale format.

sentenceCase('<text>', '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 原始字串The original string
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
結果字串result string 字串string 傳回句子大小寫結果Returns the sentence case result

範例 1Example 1

這些範例會將字串中的第一個字母大寫:These examples capitalize the first letter in a string:

sentenceCase('a')
sentenceCase('abc def')
sentenceCase('aBC dEF')

並分別傳回下列結果:And return the following results respectively:

  • AA
  • Abc defAbc def
  • Abc defAbc def

範例 2Example 2

這些範例會以指定的地區設定格式,將字串中的第一個字母做為大寫:These examples capitalizes the first letter in a string in the specified locale format:

sentenceCase('a', 'fr-FR')
sentenceCase('abc', 'en-US')
sentenceCase('aBC', 'fr-FR')

並分別傳回下列結果:And return the following results respectively:

  • AA
  • AbcAbc
  • AbcAbc

setPathToValuesetPathToValue

從 JSON 物件取出指定屬性的值。Retrieve the value of the specified property from the JSON object.

setPathToValue(<path>, <value>)
參數Parameter 必要Required 類型Type 描述Description
<Path><Path> Yes 物件 (object)object 您想要設定的路徑The path which you want to set
<value><value> Yes 物件 (object)object 您想要設定為路徑的值The value you want to set to the path
傳回值Return value 類型Type 描述Description
valuevalue 物件 (object)object 要設定的值The value be set

範例 1Example 1

下列範例會將值 1 設定為路徑:The example below sets the value 1 to the path:

setPathToValue(path.x, 1)

並傳回結果 1And returns the result 1. path.x 設定為 1path.x is set to 1.

範例 2Example 2

此範例會設定值:This example below sets the value:

setPathToValue(path.array[0], 7) + path.array[0]

並傳回結果 14And returns the result 14.

setPropertysetProperty

設定物件屬性的值,並傳回更新的物件。Set the value of an object's property and return the updated object. 若要新增屬性,請使用此函式或 addProperty() 函式。To add a new property, use this function or the addProperty() function.

setProperty(<object>, '<property>', <value>)
參數Parameter 必要Required 類型Type 描述Description
<object><object> Yes 物件 (object)object 您想要在其中設定屬性的 JSON 物件The JSON object in which you want to set a property
<property><property> Yes 字串string 要設定之屬性的名稱The name of the property to set
<value><value> Yes 任意any 要為指定屬性設定的值The value to set for the specified property
傳回值Return value 類型Type 描述Description
<updated-object><updated-object> 物件 (object)object 您已設定其屬性的更新 JSON 物件The updated JSON object whose property you set

範例Example

此範例會設定 customerProfile 物件上的 accountNumber 屬性,此物件是以 json() 函式轉換成 JSON。This example sets the accountNumber property on a customerProfile object, which is converted to JSON with the json() function. 函式會指派由 newGuid() 函式產生的值,並傳回更新的 JSON 物件:The function assigns a value generated by the newGuid() function, and returns the updated JSON object:

setProperty(json('customerProfile'), 'accountNumber', newGuid())

skipskip

移除集合前端的項目,並傳回其他所有項目。Remove items from the front of a collection, and return all the other items.

skip([<collection>], <count>)
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes arrayarray 您想要從中移除項目的集合The collection whose items you want to remove
<count><count> Yes integerinteger 正整數,表示要移除的前端項目數量A positive integer for the number of items to remove at the front
傳回值Return value 類型Type 描述Description
<updatedCollection><updatedCollection> arrayarray 移除指定項目之後的更新集合The updated collection after removing the specified items

範例Example

此範例會從指定陣列的前端移除一個項目,也就是數字 1This example removes one item, the number 1, from the front of the specified array:

skip(createArray(0, 1, 2, 3), 1)

並傳回具有剩餘項目的陣列: [1,2,3]And returns an array with the remaining items: [1,2,3].

sortBysortBy

以遞增順序排序集合中的元素,並傳回已排序的集合。Sort elements in the collection in ascending order and return the sorted collection.

sortBy([<collection>], '<property>')
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串或陣列string or array 要排序的集合The collection to sort
<property><property> No 字串string 依集合中物件元素的此特定屬性排序 (如果已設定)Sort by this specific property of the object element in the collection if set
傳回值Return value 類型Type 描述Description
<new-collection><new-collection> arrayarray 已排序元素的新集合The new collection whose elements have been sorted

範例 1Example 1

此範例會對下列集合進行排序:This example generates sorts the following collection:

sortBy(createArray(1, 2, 0, 3))

並傳回結果 [0, 1, 2, 3]And return the result [0, 1, 2, 3].

範例 2Example 2

假設您有下列集合︰Suppose you have the following collection:

{
  'nestedItems': [
    {'x': 2},
    {'x': 1},
    {'x': 3}
  ]
}

此範例會根據 x 物件屬性,產生新的已排序集合This example generates a new sorted collection based on the x object property

sortBy(nestedItems, 'x')

並傳回結果:And returns the result:

{
  'nestedItems': [
    {'x': 1},
    {'x': 2},
    {'x': 3}
  ]
}

sortByDescendingsortByDescending

以遞減順序排序集合中的元素,並傳回已排序的集合。Sort elements in the collection in descending order, and return the sorted collection.

sortBy([<collection>], '<property>')
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串或陣列string or array 要排序的集合The collection to sort
<property><property> No 字串string 依集合中物件元素的此特定屬性排序 (如果已設定)Sort by this specific property of the object element in the collection if set
傳回值Return value 類型Type 描述Description
<new-collection><new-collection> arrayarray 已排序元素的新集合The new collection whose elements have been sorted

範例 1Example 1

此範例會產生新的已排序集合:This example generates a new sorted collection:

sortByDescending(createArray(1, 2, 0, 3))

並傳回結果 [3, 2, 1, 0]And returns the result [3, 2, 1, 0].

範例 2Example 2

假設您有下列集合︰Suppose you have the following collection:

{
  'nestedItems': [
    {'x': 2},
    {'x': 1},
    {'x': 3}
  ]
}

此範例會根據 x 物件屬性,產生新的已排序集合:This example generates a new sorted collection based on the x object property:

sortByDescending(nestedItems, 'x')

並傳回此結果:And returns this result:

{
  'nestedItems': [
    {'x': 3},
    {'x': 2},
    {'x': 1}
  ]
}

splitsplit

根據原始字串中指定的分隔符號字元,傳回包含以逗號分隔之子字串的陣列。Return an array that contains substrings, separated by commas, based on the specified delimiter character in the original string.

split('<text>', '<delimiter>'?)
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要根據原始字串中指定的分隔符號分隔成子字串的字串。The string to separate into substrings based on the specified delimiter in the original string. 如果文字是 Null 值,則會將其視為空字串。If the text is a null value, it will be taken as an empty string.
<delimiter><delimiter> No 字串string 原始字串中用來作為分隔符號的字元。The character in the original string to use as the delimiter. 如果未提供分隔符號,或分隔符號為 Null 值,則預設值會是空字串。If no delimiter provided or the delimiter is a null value, the default value will be an empty string.
傳回值Return value 類型Type 描述Description
[<substring1>,<substring2>,...][<substring1>,<substring2>,...] arrayarray 包含來自原始字串並以逗號分隔之子字串的陣列An array that contains substrings from the original string, separated by commas

範例Examples

這些範例會根據指定的分隔符號字元,建立包含來自指定字串之子字串的陣列:These examples create an array with substrings from the specified string based on the specified delimiter character:

split('a**b**c', '**')
split('hello', '')
split('', 'e')
split('', '')
split('hello')

並分別傳回下列陣列作為結果:And returns the following arrays as the result repsectively:

  • ["a", "b", "c"]["a", "b", "c"]
  • ["h", "e", "l", "l", "o"]["h", "e", "l", "l", "o"]
  • [""], [ ][""], [ ]
  • ["h", "e", "l", "l", "o"]["h", "e", "l", "l", "o"]

startOfDaystartOfDay

以選擇性的地區設定格式傳回時間戳記的一天開始。Return the start of the day for a timestamp in an optional locale format.

startOfDay('<timestamp>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
'<updated-timestamp>''<updated-timestamp>' 字串string 指定的時間戳記,從當天的零小時標記開始The specified timestamp starting at the zero-hour mark for the day

範例 1Example 1

此範例會尋找當天的起始點:This example finds the start of the day:

startOfDay('2018-03-15T13:30:30.000Z')

並傳回結果 2018-03-15T00:00:00.000ZAnd returns the result 2018-03-15T00:00:00.000Z.

範例 2Example 2

這個範例會尋找地區設定為 fr-fr 的一天開始:This example finds the start of the day with the locale fr-FR:

startOfDay('2018-03-15T13:30:30.000Z', '', 'fr-FR')

並傳回結果 15/03/2018 00:00:00And returns the result 15/03/2018 00:00:00.

startOfHourstartOfHour

以選擇性的地區設定格式傳回時間戳記的小時開始。Return the start of the hour for a timestamp in an optional locale format.

startOfHour('<timestamp>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
'<updated-timestamp>''<updated-timestamp>' 字串string 指定的時間戳記,從當天的零分鐘標記開始The specified timestamp starting at the zero-minute mark for the day

範例 1Example 1

此範例會尋找小時的起始點:This example finds the start of the hour:

startOfHour('2018-03-15T13:30:30.000Z')

並傳回結果 2018-03-15T13:00:00.000ZAnd returns the result 2018-03-15T13:00:00.000Z.

範例 2Example 2

此範例會尋找地區設定為 fr-fr 的小時開始:This example finds the start of the hour with the locale fr-FR:

startOfHour('2018-03-15T13:30:30.000Z', '', 'fr-FR')

並傳回結果 15/03/2018 13:00:00And returns the result 15/03/2018 13:00:00.

startOfMonthstartOfMonth

以選擇性的地區設定格式傳回時間戳記的月首。Return the start of the month for a timestamp in an optional locale format.

startOfMonth('<timestamp>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
'<updated-timestamp>''<updated-timestamp>' 字串string 指定的時間戳記,從當月第一天的零小時標記開始The specified timestamp starting on the first day of the month at the zero-hour mark

範例 1Example 1

此範例會尋找當月的起始點:This example finds the start of the month:

startOfMonth('2018-03-15T13:30:30.000Z')

並傳回結果 2018-03-01T00:00:00.000ZAnd returns the result 2018-03-01T00:00:00.000Z.

範例 2Example 2

此範例會尋找地區設定為 fr-fr 的月份開頭:This example finds the start of the month with the locale fr-FR:

startOfMonth('2018-03-15T13:30:30.000Z', '', 'fr-FR')

並傳回結果 01/03/2018 00:00:00And returns the result 01/03/2018 00:00:00.

startsWithstartsWith

檢查字串是否以特定的子字串開始。Check whether a string starts with a specific substring. 如果找到子字串,則傳回 true;如果找不到,則傳回 falseReturn true if the substring is found, or return false if not found. 此函式區分大小寫。This function is case-insensitive.

startsWith('<text>', '<searchText>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要檢查的字串The string to check
<searchText><searchText> Yes 字串string 要尋找的起始子字串The starting substring to find
傳回值Return value 類型Type 描述Description
true 或 falsetrue or false BooleanBoolean 如果找到起始子字串,則傳回 trueReturn true if the starting substring is found. 如果找不到,則傳回 falseReturn false if not found

範例 1Example 1

此範例會檢查 hello world 字串是否以字串 hello 開始:This example checks whether the string hello world starts with the string hello:

startsWith('hello world', 'hello')

並傳回結果 trueAnd returns the result true.

範例 2Example 2

此範例會檢查 hello world 字串是否以字串 greeting 開始:This example checks whether the string hello world starts with the string greeting:

startsWith('hello world', 'greeting')

並傳回結果 falseAnd returns the result false.

字串string

以選擇性的地區設定格式傳回值的字串版本。Return the string version of a value in an optional locale format.

string(<value>, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 任意any 要轉換的值The value to convert
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<string-value><string-value> 字串string 指定值的字串版本The string version of the specified value

範例 1Example 1

此範例會建立數字 10 的字串版本:This example creates the string version of the number 10:

string(10)

並傳回字串結果 10And returns the string result 10.

範例 2Example 2

此範例會為指定的 JSON 物件建立字串,並使用反斜線字元 ( \\ ) 作為雙引號 ( " ) 的逸出字元。This example creates a string for the specified JSON object and uses the backslash character,\\, as an escape character for the double-quotation mark character, ".

string( { "name": "Sophie Owen" } )

並傳回結果 {"name": "Sophie Owen"}And returns the result { "name": "Sophie Owen" }

範例 3Example 3

這些範例會在特定地區設定中建立數位 10 的字串版本:These example creates a string version of the number 10 in a specific locale:

string(100.1, 'fr-FR')
string(100.1, 'en-US')

並分別傳回下列字串:And returns the following strings respectively:

  • 100,1100,1
  • *100.1*100.1

subsub

傳回第一個數字減去第二個數字的結果。Return the result from subtracting the second number from the first number.

sub(<minuend>, <subtrahend>)
參數Parameter 必要Required 類型Type 描述Description
<minuend><minuend> Yes numbernumber 要從中減去「減數」的數字The number from which to subtract the subtrahend
<subtrahend><subtrahend> Yes numbernumber 從「被減數」中減去的數字The number to subtract from the minuend
傳回值Return value 類型Type 描述Description
<result><result> numbernumber 從第一個數字減去第二個數字的結果The result from subtracting the second number from the first number

範例Example

此範例會從第一個數字減去第二個數字:This example subtracts the second number from the first number:

sub(10.3, .3)

並傳回結果 10And returns the result 10.

subArraysubArray

從指定的開始與結束位置傳回子陣列。Returns a subarray from specified start and end positions. 索引值會以數字 0 開頭。Index values start with the number 0.

subArray(<Array>, <startIndex>, <endIndex>)
參數Parameter 必要Required 類型Type 描述Description
<array><array> Yes arrayarray 要從中建立子陣列的陣列The array to create the subarray from
<startIndex><startIndex> Yes integerinteger 等於或大於 0 的正數,作為起始位置或索引值使用A positive number equal to or greater than 0 to use as the starting position or index value
<endIndex><endIndex> Yes integerinteger 等於或大於 0 的正數,作為結束位置或索引值使用A positive number equal to or greater than 0 to use as the ending position or index value
傳回值Return value 類型Type 描述Description
<subarray-result><subarray-result> arrayarray 具有指定項目數目的子陣列,並從來源字串中的指定索引位置起始A subarray with the specified number of items, starting at the specified index position in the source string

範例Example

此範例會從指定的陣列建立子陣列:This example creates a subarray from the specified array:

subArray(createArray('H','e','l','l','o'), 2, 5)

並傳回結果 ["l", "l", "o"]And returns the result ["l", "l", "o"].

substringsubstring

從字串中傳回從指定位置或索引起始的字元。Return characters from a string, starting from the specified position or index. 索引值會以數字 0 開頭。Index values start with the number 0.

substring('<text>', <startIndex>, <length>)
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要從中建立子字串的字串The string to create the substring from
<startIndex><startIndex> Yes integerinteger 等於或大於 0 子陣列的正數,作為起始位置或索引值使用A positive number equal to or greater than 0 subarray to use as the starting position or index value
<length><length> Yes integerinteger 子字串中的正字元數子陣列A positive number of characters subarray in the substring
傳回值Return value 類型Type 描述Description
<substring-result><substring-result> 字串string 具有指定字元數目的子字串,並以來源字串中的指定索引位置起始A substring with the specified number of characters, starting at the specified index position in the source string

範例Example

此範例會從指定字串建立 5 個字元的子字串,並且從索引值 6 起始:This example creates a five-character substring from the specified string, starting from the index value 6:

substring('hello world', 6, 5)

並傳回結果 worldAnd returns the result world.

subtractFromTimesubtractFromTime

使用選擇性的地區設定格式,從時間戳記減去時間單位數。Subtract a number of time units from a timestamp in an optional locale format . 另請參閱 getPastTime()See also getPastTime().

subtractFromTime('<timestamp>', <interval>, '<timeUnit>', '<format>'?, '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
<interval><interval> Yes integerinteger 要減去的指定時間單位數字The number of specified time units to subtract
<timeUnit><timeUnit> Yes 字串string interval 搭配使用的時間單位。The unit of time to use with interval. 可能的單位為 "Second"、"Minute"、"Hour"、"Day"、"Week"、"Month" 與 "Year"。Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year".
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<updated-timestamp><updated-timestamp> 字串string 時間戳記減去指定的時間單位數字The timestamp minus the specified number of time units

範例 1Example 1

此範例會從下列時間戳記減去一天:This example subtracts one day from a following timestamp:

subtractFromTime('2018-01-02T00:00.000Z', 1, 'Day')

並傳回結果 2018-01-01T00:00:00.000ZAnd returns the result 2018-01-01T00:00:00.000Z.

範例 2Example 2

此範例會使用 D 格式從時間戳記減去一天:This example subtracts one day from a timestamp using the D format:

subtractFromTime('2018-01-02T00:00.000Z', 1, 'Day', 'D')

並傳回 2018 年1月1日星期一 的結果。And returns the result Monday, January, 1, 2018.

範例 3Example 3

此範例會從 解除 刪除地區設定中的時間戳記減去 1 小時:This example subtracts 1 hour from a timestamp in the de-DE locale:

subtractFromTime('2018-03-15T13:00:00.000Z', 1, 'Hour', '', 'de-DE')

並傳回結果 15.03.18 12:00:00And returns the result 15.03.18 12:00:00.

Sumsum

傳回清單中數字相加的結果。Return the result from adding numbers in a list.

sum([<list of numbers>])
參數Parameter 必要Required 類型Type 描述Description
[<list of numbers>][<list of numbers>] Yes 數字陣列array of numbers 要相加的數字The numbers to add
傳回值Return value 類型Type 描述Description
<result-sum><result-sum> numbernumber 指定數字相加的結果The result from adding the specified numbers

範例Example

此範例會相加指定的數字:This example adds the specified numbers:

sum(createArray(1, 1.5))

並傳回結果 2.5And returns the result 2.5.

taketake

傳回集合中的前端項目。Return items from the front of a collection.

take('<collection>', <count>)
take([<collection>], <count>)
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes 字串或陣列string or array 您需要其中項目的集合The collection whose items you want
<count><count> Yes integerinteger 正整數,表示您需要的前端項目數量A positive integer for the number of items you want from the front
傳回值Return value 類型Type 描述Description
<subset> 或 [<subset>]<subset> or [<subset>] 個別的字串或陣列String or Array, respectively 從原始集合前端取得指定項目數量的字串或陣列A string or array that has the specified number of items taken from the front of the original collection

範例Example

此範例會從這些集合的前端取得指定數目的項目:These examples get the specified number of items from the front of these collections:

take('abcde', 3)
take(createArray(0, 1, 2, 3, 4), 3)

並分別傳回下列結果:And return the following results respectively:

  • abcabc
  • [0, 1, 2][0, 1, 2]

刻度ticks

傳回指定時間戳記的刻度屬性值。Return the ticks property value of a specified timestamp. 一刻度是 100 奈秒的間隔。A tick is 100-nanosecond interval.

ticks('<timestamp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 時間戳記的字串The string for a timestamp
傳回值Return value 類型Type 描述Description
<ticks-number><ticks-number> 整數 (Javascript 中的 BigInt)integer (bigint in Javascript) 自指定時間戳記以來的刻度數目The number of ticks since the specified timestamp

範例Example

範例會將時間戳記轉換成其刻度屬性The example convert a timestamp to its ticks property

ticks('2018-01-01T08:00:00.000Z')

並傳回結果 636503904000000000And returns the result 636503904000000000.

ticksToDaysticksToDays

將刻度屬性值轉換為天數。Convert a ticks property value to the number of days.

ticksToDays('ticks')
參數Parameter 必要Required 類型Type 描述Description
<><ticks> Yes integerinteger 要轉換的刻度屬性值The ticks property value to convert
傳回值Return value 類型Type 描述Description
<天數><number-of-days> numbernumber 從滴答屬性值轉換的天數The number of days converted from the ticks property value

範例Example

此範例會將刻度屬性值轉換為數天:This example converts a ticks property value to a number of days:

ticksToDays(2193385800000000)

並傳回數位 2538.64097222And returns the number 2538.64097222.

ticksToHoursticksToHours

將刻度屬性值轉換為時數。Convert a ticks property value to the number of hours.

ticksToHours('ticks')
參數Parameter 必要Required 類型Type 描述Description
<><ticks> Yes 整數Integer 要轉換的刻度屬性值The ticks property value to convert
傳回值Return value 類型Type 描述Description
<小時數><number-of-hours> numbernumber 從刻度屬性值轉換的時數The number of hours converted from the ticks property value

範例Example

此範例會將刻度屬性值轉換為數小時:This example converts a ticks property value to a number of hours:

ticksToHours(2193385800000000)

並傳回 60927.383333333331 的數位。And returns the number 60927.383333333331.

ticksToMinutesticksToMinutes

將刻度屬性值轉換為分鐘數。Convert a ticks property value to the number of minutes.

ticksToMinutes('ticks')
參數Parameter 必要Required 類型Type 描述Description
<><ticks> Yes integerinteger 要轉換的刻度屬性值The ticks property value to convert
傳回值Return value 類型Type 描述Description
<分鐘數><number-of-minutes> numbernumber 從刻度屬性值轉換的分鐘數The number of minutes converted from the ticks property value

範例Example

此範例會將刻度屬性值轉換為分鐘數:This example converts a ticks property value to a number of minutes:

ticksToMinutes(2193385800000000)

並傳回數位 3655643.0185And returns the number 3655643.0185.

首碼大寫titleCase

以選擇性的本機格式,將字串中每個單字的第一個字母大寫。Capitalize the first letter of each word in a string in an optional local format.

titleCase('<text>', '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 原始字串The original string
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
結果字串result string 字串string 標題大小寫結果The title case result

範例 1Example 1

這些範例會將字串中每個單字的第一個字母大寫:These examples capitalize the first letter of each word in a string:

titleCase('a')
titleCase('abc def')
titleCase('aBC dEF')

並分別傳回下列結果:And return the following results respectively:

  • AA
  • Abc DefAbc Def
  • Abc DefAbc Def

範例 2Example 2

這些範例會將字串中的第一個字母大寫為 en-us 格式:These examples capitalize the first letter in a string in the en-US format:

titleCase('a', 'en-US')
titleCase('aBC dEF', 'en-US')

並分別傳回下列結果:And return the following results respectively:

  • AA
  • Abc DefAbc Def

toLowertoLower

以選擇性的地區設定格式傳回小寫的字串。Return a string in lowercase in an optional locale format. 如果字串中的字元沒有小寫版本,則該字元在傳回的字串中會保持不變。If a character in the string doesn't have a lowercase version, that character stays unchanged in the returned string.

toLower('<text>', '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要以小寫格式傳回的字串The string to return in lowercase format
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<lowercase-text><lowercase-text> 字串string 小寫格式的原始字串The original string in lowercase format

範例 1Example 1

此範例會將字串轉換成小寫:This example converts a string to lowercase:

toLower('Hello World')

並傳回結果 hello worldAnd returns the result hello world.

範例 2Example 2

此範例會將字串轉換為 fr-fr 格式的小寫:This example converts a string to lowercase in the fr-FR format:

toUpper('Hello World', 'fr-FR')

並傳回結果 hello worldAnd returns the result hello world.

toUppertoUpper

以選擇性的地區設定格式傳回大寫的字串。Return a string in uppercase in an optional locale format.. 如果字串中的字元沒有大寫版本,則該字元在傳回的字串中會保持不變。If a character in the string doesn't have an uppercase version, that character stays unchanged in the returned string.

toUpper('<text>', '<locale>'?)
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要以大寫格式傳回的字串The string to return in uppercase format
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<uppercase-text><uppercase-text> 字串string 大寫格式的原始字串The original string in uppercase format

範例 1Example 1

此範例會將字串轉換成大寫:This example converts a string to uppercase:

toUpper('Hello World')

並傳回結果 HELLO WORLDAnd returns the result HELLO WORLD.

範例 2Example 2

此範例會將字串轉換為 fr-fr 格式的大寫:This example converts a string to uppercase in the fr-FR format:

toUpper('Hello World', 'fr-FR')

並傳回結果 HELLO WORLDAnd returns the result HELLO WORLD.

修剪trim

移除字串的開頭和尾端空白字元,並傳回更新後的字串。Remove leading and trailing whitespace from a string, and return the updated string.

trim('<text>')
參數Parameter 必要Required 類型Type 描述Description
<text><text> Yes 字串string 要為其移除開頭和尾端空白字元的字串The string that has the leading and trailing whitespace to remove
傳回值Return value 類型Type 描述Description
<updatedText><updatedText> 字串string 不含開頭或尾端空白字元的原始字串更新版本An updated version for the original string without leading or trailing whitespace

範例Example

此範例會從 " Hello World " 字串中移除開頭與結尾空白字元:This example removes the leading and trailing whitespace from the string " Hello World ":

trim(' Hello World  ')

並傳回已修剪的結果 Hello WorldAnd returns the trimmed result Hello World.

unionunion

傳回具有指定集合中所有項目的集合。Return a collection that has all the items from the specified collections. 出現在結果中的項目,可以出現在任何傳遞至此函式的集合中。To appear in the result, an item can appear in any collection passed to this function. 如果一個或多個項目有相同的名稱,則具有該名稱的最後一個項目會出現在結果中。If one or more items have the same name, the last item with that name appears in the result.

union('<collection1>', '<collection2>', ...)
union([<collection1>], [<collection2>], ...)
參數Parameter 必要Required 類型Type 描述Description
<collection1>, <collection2>, ...<collection1>, <collection2>, ... Yes 陣列或物件,但不可以兩者並存array or object, but not both 您想要其中所有項目的集合The collections from where you want all the items
傳回值Return value 類型Type 描述Description
<updatedCollection><updatedCollection> 個別的陣列或物件array or object, respectively 具有指定集合中所有項目的集合。A collection with all the items from the specified collections. 未新增任何重複項目。No duplicates added.

範例Example

此範例會從下列集合取得所有項目:This example gets all the items from the following collections:

union(createArray(1, 2, 3), createArray(1, 2, 10, 101))

並傳回結果 [1, 2, 3, 10, 101]And returns the result [1, 2, 3, 10, 101].

uniqueunique

從陣列中移除所有重複項。Remove all duplicates from an array.

unique([<collection>])
參數Parameter 必要Required 類型Type 描述Description
<collection><collection> Yes arrayarray 要修改的集合The collection to modify
傳回值Return value 類型Type 描述Description
<new-collection><new-collection> arrayarray 已移除重複元素的新集合New collection with duplicate elements removed

範例 1Example 1

此範例會從下列陣列移除重複的元素:This example removes duplicate elements from the following array:

unique(createArray(1, 2, 1))

並傳回結果 [1, 2]And returns the result [1, 2].

uriComponenturiComponent

傳回統一資源識別項 (URI) 元件的二進位版本。Return the binary version of a uniform resource identifier (URI) component.

uriComponent('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要轉換成 URI 編碼格式的字串The string to convert to URI-encoded format
傳回值Return value 類型Type 描述Description
<encoded-uri><encoded-uri> 字串string 具有逸出字元的 URI 編碼字串The URI-encoded string with escape characters

範例Example

此範例會建立字串的 URI 編碼版本:This example creates a URI-encoded version of a string:

uriComponent('https://contoso.com')

並傳回結果 http%3A%2F%2Fcontoso.comAnd returns the result http%3A%2F%2Fcontoso.com.

uriComponentToStringuriComponentToString

傳回統一資源識別項 (URI) 編碼字串的字串版本,也就是有效地解碼 URI 編碼字串。Return the string version of a uniform resource identifier (URI) encoded string, effectively decoding the URI-encoded string.

uriComponentToString('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 要解碼的 URI 編碼字串The URI-encoded string to decode
傳回值Return value 類型Type 描述Description
<binary-for-encoded-uri><binary-for-encoded-uri> 字串string URI 編碼字串的已解碼版本The decoded version for the URI-encoded string

範例Example

此範例會建立 URI 編碼字串的已解碼字串版本:This example creates the decoded string version of a URI-encoded string:

uriComponentToString('http%3A%2F%2Fcontoso.com')

並傳回結果 https://contoso.comAnd returns the result https://contoso.com.

uriHosturiHost

傳回統一資源識別項 (URI) 的主機值。Return the host value of a unified resource identifier (URI).

uriHost('<uri>')
參數Parameter 必要Required 類型Type 描述Description
<uri><uri> Yes 字串string 您需要其主機值的 URIThe URI whose host value you want
傳回值Return value 類型Type 描述Description
<host-value><host-value> 字串string 指定 URI 的主機值The host value of the specified URI

範例Example

此範例會尋找下列 URI 的主機值:This example finds the host value of the following URI:

uriHost('https://www.localhost.com:8080')

並傳回結果 www.localhost.comAnd returns the result www.localhost.com.

uriPathuriPath

傳回統一資源識別項 (URI) 的路徑值。Return the path value of a unified resource identifier (URI).

uriPath('<uri>')
參數Parameter 必要Required 類型Type 描述Description
<uri><uri> Yes 字串string 您需要其路徑值的 URIThe URI whose path value you want
傳回值Return value 類型Type 描述Description
<path-value><path-value> 字串string 指定 URI 的路徑值The path value of the specified URI

範例Example

此範例會尋找下列 URI 的路徑值:This example finds the path value of the following URI:

uriPath('http://www.contoso.com/catalog/shownew.htm?date=today')

並傳回結果 /catalog/shownew.htmAnd returns the result /catalog/shownew.htm.

uriPathAndQueryuriPathAndQuery

傳回統一資源識別項 (URI) 的路徑與查詢值。Return the path and query value of a unified resource identifier (URI).

uriPathAndQuery('<uri>')
參數Parameter 必要Required 類型Type 描述Description
<uri><uri> Yes 字串string 您需要其路徑與查詢值的 URIThe URI whose path and query value you want
傳回值Return value 類型Type 描述Description
<path-query-value><path-query-value> 字串string 指定 URI 的路徑與查詢值The path and query value of the specified URI

範例Example

此範例會尋找下列 URI 的路徑與查詢值:This example finds the path and query value of the following URI:

uriPathAndQuery('http://www.contoso.com/catalog/shownew.htm?date=today')

並傳回結果 /catalog/shownew.htm?date=todayAnd returns the result /catalog/shownew.htm?date=today.

uriPorturiPort

傳回統一資源識別項 (URI) 的連接埠值。Return the port value of a unified resource identifier (URI).

uriPort('<uri>')
參數Parameter 必要Required 類型Type 描述Description
<uri><uri> Yes 字串string 您需要其路徑值的 URIThe URI whose path value you want
傳回值Return value 類型Type 描述Description
<port-value><port-value> 字串string 指定 URI 的連接埠值The port value of the specified URI

範例Example

此範例會尋找下列 URI 的連接埠值:This example finds the port value of the following URI:

uriPort('http://www.localhost:8080')

並傳回結果 8080And returns the result 8080.

uriQueryuriQuery

傳回統一資源識別項 (URI) 的查詢值。Return the query value of a unified resource identifier (URI).

uriQuery('<uri>')
參數Parameter 必要Required 類型Type 描述Description
<uri><uri> Yes 字串string 您需要其查詢值的 URIThe URI whose query value you want
傳回值Return value 類型Type 描述Description
<query-value><query-value> 字串string 指定 URI 的查詢值The query value of the specified URI

範例Example

此範例會尋找下列 URI 的查詢值:This example finds the query value of the following URI:

uriQuery('http://www.contoso.com/catalog/shownew.htm?date=today')

並傳回結果 ?date=todayAnd returns the result ?date=today.

uriSchemeuriScheme

傳回統一資源識別項 (URI) 的配置值。Return the scheme value of a unified resource identifier (URI).

uriScheme('<uri>')
參數Parameter 必要Required 類型Type 描述Description
<uri><uri> Yes 字串string 您需要其查詢值的 URIThe URI whose query value you want
傳回值Return value 類型Type 描述Description
<scheme-value><scheme-value> 字串string 指定 URI 的配置值The scheme value of the specified URI

範例Example

此範例會尋找下列 URI 的配置值:This example finds the scheme value of the following URI:

uriQuery('http://www.contoso.com/catalog/shownew.htm?date=today')

並傳回結果 httpAnd returns the result http.

utcNowutcNow

以字串形式傳回選用地區設定格式的目前時間戳記。Return the current timestamp in an optional locale format as a string.

utcNow('<format>', '<locale>'?)

您可以選擇性地以 <format> 參數指定不同格式。Optionally, you can specify a different format with the <format> parameter.

參數Parameter 必要Required 類型Type 描述Description
<format><format> No 字串string 自訂格式模式 (部分機器翻譯)。A custom format pattern. 時間戳記的預設格式為 UTC ISO 格式 (YYYY-MM-DDTHH:mm:ss.fffZ),其符合 ISO 8601 (英文)。The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ, which complies with ISO 8601.
<locale><locale> No 字串string 文化特性資訊的選擇性地區設定An optional locale of culture infomation
傳回值Return value 類型Type 描述Description
<current-timestamp><current-timestamp> 字串string 目前的日期和時間The current date and time

範例 1Example 1

假設日期為 2018 年 4 月 15 日 下午 1:00Suppose the date is April 15, 2018 at 1:00:00 PM. 此範例會取得時間戳記:This example gets the timestamp:

utcNow()

並傳回結果 2018-04-15T13:00:00.000ZAnd returns the result 2018-04-15T13:00:00.000Z.

範例 2Example 2

假設日期為 2018 年 4 月 15 日 下午 1:00Suppose the date is April 15, 2018 at 1:00:00 PM. 此範例會使用選擇性的 D 格式取得目前的時間戳記:This example gets the current timestamp using the optional D format:

utcNow('D')

並傳回結果 Sunday, April 15, 2018And returns the result Sunday, April 15, 2018.

範例 3Example 3

假設日期為 2018 年 4 月 15 日 下午 1:00Suppose the date is April 15, 2018 at 1:00:00 PM. 此範例會使用 取消 刪除地區設定來取得目前的時間戳記:This example gets the current timestamp using the de-DE locale:

utcNow('', 'de-DE')

並傳回結果 15.04.18 13:00:00And returns the result 15.04.18 13:00:00.

其中where

篩選每個元素,並傳回符合特定條件之已篩選元素的新集合。Filter on each element and return the new collection of filtered elements which match a specific condition.

where([<collection/instance>], <iteratorName>, <function>)
參數Parameter 必要Required 類型Type 描述Description
<collection/instance><collection/instance> Yes arrayarray 包含項目的集合The collection with the items
<iteratorName><iteratorName> Yes 迭代器名稱iterater name 金鑰專案The key item
<function><function> Yes expressionexpression 用來篩選項目的條件函式Condition function used to filter items
傳回值Return value 類型Type 描述Description
<new-collection/new-object><new-collection/new-object> 陣列/物件array/object 已使用函式篩選每個元素的新集合The new collection which each element has been filtered with the function

範例 1Example 1

此範例會產生新的集合:This example generates a new collection:

where(createArray(0, 1, 2, 3), x, x > 1)

並傳回結果 [2, 3]And returns the result [2, 3].

範例 2Example 2

這些範例會產生新的集合:These examples generate a new collection:

where(json("{'name': 'jack', 'age': '15'}"), x, x.value == 'jack')
where(json("{'name': 'jack', 'age': '15'}"), x=> x.value == 'jack')

並傳回結果 [' name:插口 ',' age: 15 ']And return the result ['name:jack', 'age:15']. 請注意,第二個運算式是 lambda 運算式,可讓您找到更容易讀取的運算式。Note that the second expression is a lambda expression, which some find more readable.

Xmlxml

僅限 C#C# only. 傳回包含 JSON 物件的 XML 版本字串。Return the XML version of a string that contains a JSON object.

xml('<value>')
參數Parameter 必要Required 類型Type 描述Description
<value><value> Yes 字串string 具有要轉換之 JSON 物件的字串 JSON 物件必須只能有一個根屬性,且不可以是陣列。The string with the JSON object to convert The JSON object must have only one root property, which can't be an array. 使用 \ 作為雙引號 (") 的逸出字元。Use \ as an escape character for the double quotation mark (").
傳回值Return value 類型Type 描述Description
<xml-version><xml-version> 物件 (object)object 所指定字串或 JSON 物件的編碼 XMLThe encoded XML for the specified string or JSON object

範例 1Example 1

此範例會為包含 JSON 物件的字串建立 XML 版本:This example creates the XML version for a string, which contains a JSON object:

xml(json('{ \"name\": \"Sophia Owen\" }'))

並傳回結果 XML:And returns the result XML:

<name>Sophia Owen</name>

範例 2Example 2

假設您有一個 person JSON 物件,如下所示:Suppose you have a person JSON object, seen below:

{
  "person": {
    "name": "Sophia Owen",
    "city": "Seattle"
  }
}

此範例會為包含此 JSON 物件的字串建立 XML:This example creates XML of a string that contains this JSON object:

xml(json('{\"person\": {\"name\": \"Sophia Owen\", \"city\": \"Seattle\"}}'))

並傳回結果 XML:And returns the result XML:

<person>
  <name>Sophia Owen</name>
  <city>Seattle</city>
<person

xPathxPath

僅限 C#C# only. 檢查 XML 中是否有符合 XPath (XML 路徑語言) 運算式的節點或值,並傳回符合的節點或值。Check XML for nodes or values that match an XPath (XML Path Language) expression, and return the matching nodes or values. XPath 運算式 (稱為 XPath) 可協助您瀏覽 XML 文件結構,讓您可以在 XML 內容中選取節點或計算值。An XPath expression (referred to as XPath) helps you navigate an XML document structure so that you can select nodes or compute values in the XML content.

xPath('<xml>', '<xpath>')
參數Parameter 必要Required 類型Type 描述Description
<xml><xml> Yes 任意any XML 字串,將對其搜尋是否有符合 XPath 運算式的值或節點The XML string to search for nodes or values that match an XPath expression value
<xPath><xPath> Yes 任意any 用來尋找相符 XML 節點或值的 XPath 運算式The XPath expression used to find matching XML nodes or values
傳回值Return value 類型Type 描述Description
<xml-node><xml-node> XMLXML 只有單一節點符合指定的 XPath 運算式時會傳回 XML 節點An XML node when only a single node matches the specified XPath expression
<value><value> 任意any 只有單一值符合指定的 XPath 運算式時,會傳回 XML 節點的值The value from an XML node when only a single value matches the specified XPath expression
< [, , ...] -or- [, , ...] ><[, , ...] -or- [, , ...]> arrayarray 陣列,其中有符合指定 XPath 運算式的 XML 節點或值An array with XML nodes or values that match the specified XPath expression

範例 1Example 1

此範例會尋找是否有節點符合指定引數中的 <name></name> 節點,並傳回包含這些節點值的陣列:This example finds nodes that match the <name></name> node in the specified arguments, and returns an array with those node values:

xpath(items, '/produce/item/name')

包含 items 字串的引數,其中包含此 XML:The arguments include the items string, which contains this XML:

"<?xml version="1.0"?> <produce> <item> <name>Gala</name> <type>apple</type> <count>20</count> </item> <item> <name>Honeycrisp</name> <type>apple</type> <count>10</count> </item> </produce>"

以下是所產生的陣列,其中有符合 <name></name> 的節點:Here's the resulting array with the nodes that match <name></name>:

[ <name>Gala</name>, <name>Honeycrisp</name> ]

範例 2Example 2

遵循範例 1,此範例會尋找符合 <count></count> 節點的節點,並使用 sum() 函式將這些節點值相加:Following example 1, this example finds nodes that match the <count></count> node and adds those node values with the sum() function:

xpath(xml(parameters('items')), 'sum(/produce/item/count)')

並傳回結果 30And returns the result 30.

yearyear

傳回指定時間戳記的年份。Return the year of the specified timestamp.

year('<timestamp>')
參數Parameter 必要Required 類型Type 描述Description
<timestamp><timestamp> Yes 字串string 包含時間戳記的字串The string that contains the timestamp
傳回值Return value 類型Type 描述Description
<year><year> integerinteger 指定時間戳記中的年份The year in the specified timestamp

範例Example

此範例會評估年份的時間戳記:This example evaluates the timestamp for the year:

year('2018-03-15T00:00:00.000Z')

並傳回結果 2018And it returns the result 2018.