07-24-2024 08:51 AM
Hello,
I need to filter an array through a specific number of a string in this array, as shown in the image below
But I'm not able to create this filter
Can you help me please?
07-24-2024 09:00 AM - edited 07-24-2024 09:00 AM
It is not a "filter" if the output array has more elements than the input array and your code does not make much sense.
Can you explain the processing steps and the final output you want?
07-24-2024 09:04 AM
There are cases where I don't have some No.
For example, in this case I don't have No.2, No.6 and No.8, and in the lines that should be these values should be with the dash
The final array should follow an ascending order of these values, and the No. that are not in the initial array should be with the trace
07-24-2024 09:05 AM
OK, it seems you want to insert sentinel elements where the digits are not consecutive.
Are the numerics guaranteed to be singe digits or could there be more (e.g. H0-No456-CH)?
07-24-2024 09:08 AM
The values do not exceed 30
E.g.: H0-No30-CH
07-24-2024 09:15 AM - edited 07-24-2024 09:39 AM
Start with this and modify as needed (e.g. read the number of the last element to determine the number of iterations needed, etc.)
Note that for array diagram constants always show one element past the final (or show the scrollbars), else we have no idea how large the array really is.
If you have control over how the input is formed, I would recommend to have all numbers padded with sufficient zeroes to the same number of digits, e.g.
H0-No01-CH
H0-No02-CH
...
H0-No25-CH
H0-No26-CH
...
This makes alphabetic sorting the same as numeric sorting, especially useful for e.g. file names.