I have several arrays of lines of output in a program that use '#' and ' '. The arrays could be any combination of these two elements, i.e.
[..., #, #, #, #, ' ', ' ', ...]
[..., #, #, ' ', ' ', #, #, ...]
[..., ' ', ' ', #, #, ' ', ' ', ...] etc.
Is there a way of trimming the start and end of the array to remove all ' ' until a # is found and leave all ' ' between the # alone?