配列の中に指定文字列があるかないかで条件分岐したい

いつもお世話に合っております。
繰り返しコレクションの各要素の中で、配列{“A”,“B”,“C”,“D”}を使い、条件分岐させたいです。
現在の繰り返し要素itemが、配列{“A”,“B”,“C”,“D”}に含まれているか含まれていないかで条件分岐させたいのですが、どのように条件式を書いたら良いのか分かりません。
教えて頂きたくよろしくお願い致します。

こんにちは

配列をarrStr, itemがString型の場合

arrStr.Contains(item)

になるかと思います。

image

itemがobjectの場合は、item.ToString としてください

2 Likes

@miwa_yamamoto

Inside the For Each loop, use an If activity to check if the current item exists in the array:

If activity:
Condition: yourArray.Contains(currentItem.ToString)

If activity (Condition is True):
Then: # Add activities for the True branch
If activity (Condition is False):
Else: # Add activities for the False branch

1 Like

HI @miwa_yamamoto

You can check like this:
myArray.Contains(currentItem.ToString)

1 Like

Hi @miwa_yamamoto

str_Array= {"A","B","C","D"}
  1. Use For each to iterate through Array.
  2. Under that use an If Condition
str_Array.Contains(currentItem)
  1. Print using Message Box.

Hope it helps!!
Regards,

1 Like

@Yoichi
@supriya117
@rlgandu
@Parvathy

ありがとうございます。
お陰様で無事に条件分岐することが出来ました。
どうもありがとうございました。

Yoichi様

こちらで躓いておりました。
大変勉強になりました。
ありがとうございました。

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.