2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Power Automate の文字列 配列 特化関数チートシート

2
Last updated at Posted at 2026-03-29

Power Automate で式を書く際、「配列を操作したいけど、どの関数を使えばいいんだっけ?」「この関数、文字列にも使えるのかな?」と迷うことはありませんか?

本記事では、頻繁に使用する文字列操作・配列操作の関数を逆引きチートシートとしてまとめました。(ほぼ自分用)

本記事のポイント:

  • 逆引きリファレンス:やりたいことから関数を素早く探せます。
  • 共通関数の徹底解説lengthcontains など、「文字列」と「配列」の両方に対応している関数について、それぞれの挙動の違いをサンプルコード付きで詳しく解説しています。

参考Azure Logic Apps と Power Automate のワークフローで使用する式の関数に関する参考ガイド(Microsoft 公式)

① 配列用関数

関数 説明 戻り値
createArray 複数の値を配列にする 配列
union 複数の配列を結合して重複を除外する 配列
intersection 複数の配列すべてに共通する要素だけを含む配列を返す 配列
chunk 指定した要素数で分割 配列
first 最初の要素を取得 文字列
last 最後の要素を取得 文字列
take 先頭から指定した数の要素を取得 配列
skip 先頭から指定した数の要素を除いた残りの配列を取得 配列
sort 配列の要素を昇順にする(列の指定可) 配列
reverse 配列の要素を逆順にする 配列
join 指定した区切り文字で配列を結合 文字列
contains 配列に特定の文字が含まれているか判定 真偽値
empty 配列が空([])であるか判定 真偽値

② 文字列用関数

関数 説明 戻り値
chunk 指定した文字数で分割 配列
split 指定した区切り文字で分割 配列
concat 2つ以上の文字列を結合 文字列
first 最初の文字を取得 文字列
last 最後の文字を取得 文字列
take 先頭から指定した数の文字列を取得 配列
skip 先頭から指定した数の文字列を除いた残りの文字列を取得 配列
slice 指定した開始・終了文字位置にある文字列を取得 文字列
substring 指定した文字位置から指定した文字数を取得 文字列
replace 特定の文字を指定した文字にすべて変換 文字列
toLower すべて小文字に変換 文字列
toUpper すべて大文字に変換 文字列
trim 文字列の先頭と末尾の空白を削除して返す 文字列
length 文字数を数える 数値
indexOf 指定した文字が先頭から何文字目にあるか数える 数値
lastIndexOf 指定した文字が先頭から何文字目にあるか数える。複数あれば一番最後の部分を数える 数値
nthIndexOf 指定した文字が先頭から何文字目にあるか数える。複数あればn番目の部分を数える 数値
startsWith 指定した文字列で始まるか判定 真偽値
endsWith 指定した文字列で終わるか判定 真偽値
contains 文字列に特定の文字が含まれているか判定 真偽値
empty 文字列が空文字('')かを判定 真偽値

③ 類似サンプルコード

類似した挙動を持つ主要な関数の例文です。

join / concat

結合して1つのデータにします。

  • join (配列用): 配列の要素同士を1つの文字列にします。
  • concat (文字列用): 文字列同士を1つの文字列にします。
// join の場合(配列 → 文字列)
join(createArray('A', 'B', 'C'), '') 
// → 'ABC'

// concat の場合(文字列 → 文字列)
concat('A', 'B', 'C') 
// → 'ABC'

④ 共通サンプルコード

文字列と配列のどちらにも使用できる関数の例文です。

length

対象の長さを返します。

  • 文字列: 文字数
  • 配列: 要素数
// 文字列の場合
length('Hello') 
// → 5

// 配列の場合
length(createArray(1, 2, 3)) 
// → 3

chunk

対象を指定した長さ(要素数)ごとに分割して、配列の配列を作成します。

// 文字列の場合
chunk('abcdef', 2)
// → ['ab', 'cd', 'ef']

// 配列の場合
chunk(createArray(1, 2, 3, 4, 5), 2)
// → [[1, 2], [3, 4], [5]]

first / last

対象の先頭、または末尾のデータを取り出します。

  • 文字列: 最初(最後)の1文字を取得
  • 配列: 最初(最後)の要素を取得
// 文字列の場合
first('Hello') // → 'H'
last('Hello')  // → 'o'

// 配列の場合
first(createArray('a', 'b', 'c')) // → 'a'
last(createArray('a', 'b', 'c'))  // → 'c'

take / skip

先頭から指定した数だけ「取得」するか「除外」するかを操作します。

  • 文字列: 指定した文字数で抽出/除外
  • 配列: 指定した要素数で抽出/除外
// 文字列の場合
take('Hello', 2) // → 'He'
skip('Hello', 2) // → 'llo'

// 配列の場合
take(createArray(1, 2, 3), 2) // → [1, 2]
skip(createArray(1, 2, 3), 2) // → [3]

contains

指定した値が含まれているかを判定します(大文字小文字を区別します)。

  • 文字列: 部分一致する文字列があるか
  • 配列: 完全に一致する要素があるか(部分一致では不可)
// 文字列の場合
contains('Hello World', 'World') // → true

// 配列の場合
contains(createArray('Apple', 'Banana'), 'Apple') // → true
contains(createArray('Apple', 'Banana'), 'A')     // → false

empty

対象が空(長さが0)かどうかを判定します。

// 文字列の場合
empty('') // → true
empty(' ') // → false (空白スペースは文字として扱われる)

// 配列の場合
empty(createArray()) // → true
empty(createArray('')) // → false
2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?