String Indices - Value of type 'Int' has no subscripts

I’ve moved this thread from Development: Swift Syntax to the Using Swift category. Note that the Development category is for discussion about developing Swift itself.

(Side note for moderators: is there any way that we can move Using Swift to the top of the category-selection dropdown menu for new posts? I’ve asked about this before and haven’t seen a definitive answer. This type of thing happens a lot with new people posting in the Development section, and I think putting Using Swift at the top of the list would make a noticeable difference.)

In your code example, strs is an array of strings. Each element of that array is a string, but the array itself is, well, an array. Your code does not use any string indexes at all.

It is not clear to me what you are attempting to achieve here. Could you describe in words what you want the function to do?

I could make a guess based on its name, but I think it will be more helpful if you could explain what the input and output of the function are meant to be, and how they are related.

4 Likes