Introduce some array and string helper functions

Introduce some convenience functions for common code patterns.

Not a big deal but I think it helps make things clearer.