range(0,sub(length(outputs('Compose_2')),1))
Expression used for Map key & value:
| Key |
Value |
| index |
item() |
| item |
outputs('Compose_2')[item()]
|
Now, add filter array to find the index of number in an array. Pass the output of Select action to the 'From' parameter:
click "Edit in advanced mode" button on the bottom and enter the below query:
@equals(isInt(item()?['item']), true)
After that, add another filter array to get all the elements whose index is less than where number is stored. In From parameter, pass the output body of select action as shown below:
Filter query used in above screenshot:
@less(item()?['index'], first(body('Filter_array'))?['index'])
Add another Select action to create an array of words that appears before the number in the input string. In from parameter, pass the body of filter 2 action:
Click on "Switch Map to text mode" button on the right side of Map parameter:
Enter the following expression in the Map textbox:
item()?['item']
To calculate the length of the required characters, we will combine the array elements and then using expression calculate its length to give the final result. Add compose action for this operation:
The output of compose gives the count of characters before the number appears in the input string.
Output:
If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.
Thanks