How to count occurrence of same substring in an array of String


I need to count the no. of occurrence of IN and OUT from the array = [10:16:50(in),10:58:47(out),11:35:14(in),12:52:22(out),12:54:37(in),13:33:22(out),13:38:36(in),14:26:50(out),15:34:48(in),17:19:41(out),17:21:52(in),17:56:46(out),18:17:55(in),20:34:38(out),
], count no. of times out and in occurred and then make sure that for each in there is an out in the array.

welcome to the forum

your case can be handled as following:
splitting and sorting the ins and out:

  • it is filtering the array items on e.g. IN
  • then sort the filtered items on the time info

similar it is done for the outs

Finally it is checking if the count of IN and OUT items are the same and adds the in/out pairs to a datatable:


find starter help here:
FindPairs_in-out-items_ByDate.xaml (9.1 KB)

1 Like

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