Flex Gateway新着情報
Governance新着情報
Monitoring API ManagerFlex Gateway新着情報
Governance新着情報
Monitoring API Manager2.x
Mule 4
3.9
1.1
2.x
1.2
7.x
lastIndexOf
lastIndexOf
特定の配列の指定された要素の最後の出現のインデックスを返し、この配列に要素が含まれていない場合は -1
を返します。
DataWeave バージョン 2.4.0 で導入されました。
名前 | 説明 |
---|---|
|
検索する要素の配列。 |
|
検索する値。 |
次の例では、さまざまな入力での indexOf
の動作を示します。
%dw 2.0
output application/json
---
{
present: ["a","b","c","d"] lastIndexOf "c",
notPresent: ["x","w","x"] lastIndexOf "c",
presentMoreThanOnce: ["a","b","c","c"] lastIndexOf "c",
}
DataWeave
{
"present": 2,
"notPresent": -1,
"presentMoreThanOnce": 3
}
Json
文字列を入力として取得し、入力内の特定の検索文字列の最後の出現のインデックスを返します。検索文字列が入力に存在しない場合、この関数では -1
を返します。
DataWeave バージョン 2.4.0 で導入されました。
名前 | 説明 |
---|---|
|
検索する文字列。 |
|
入力文字列内で検索する文字列値。 |
次の例では、さまざまな入力での indexOf
の動作を示します。
%dw 2.0
output application/json
---
{
present: "abcd" lastIndexOf "c",
notPresent: "xyz" lastIndexOf "c",
presentMoreThanOnce: "abcdc" lastIndexOf "c",
}
DataWeave
{
"present": 2,
"notPresent": -1,
"presentMoreThanOnce": 4
}
Json
lastIndexOf
を null
値に使用できるようにするヘルパー関数。
DataWeave バージョン 2.4.0 で導入されました。