I have a sorted array of strings, and now I want to print them out while labelling them.
For example, if my array is [ ‘1_array_content’, ‘3_array_content’, ‘apple’, ‘ant’, ‘bucket’]
Then I want to print them out like this: How can I add the first alphabet as a label? And how does that work for numerical first alphabets (all of them will fall under the [0-9] label.
[0-9]
1_array_content
3_array_content
[a]
ant
apple
[b]
bucket