How can I check what levels are included in the build in code?

I have a text field on my main menu for loading levels quickly during build testing, but I would like to add a check so if the user types a level name incorrectly instead of throwing runtime errors and staying on the menu it can instead tell the user that they entered an invalid string.

I know that I could do this with a switch and manually code each level into it as more are added, but that’s the opposite of modular.

Oddly, there doesn’t seem to be an array of level names that I can find.

The best solution I can think of is to load a level by number instead of by name. Application.levelCount gives you the total number of levels loaded, so someone could type in their level by ID number (and also check if someone types in a number that’s above the limit).