Check if a character is lowerCase or upperCase

lowercase, swift

Solution

 var input = "The quick BroWn fOX jumpS Over tHe lazY DOg"

 var inputArray = Array(input)

 for character in inputArray {

 var strLower = "[a-z]";

 var strChar = NSString(format: "%c",character )
 let strTest = NSPredicate(format:"SELF MATCHES %@", strLower );
 if strTest .evaluateWithObject(strChar)
 {
   // lower character
 }
 else
 {
   // upper character
 }
}

Problem

I am trying to make a program that stores a string in a variable called `input`. With this `input` variable, I am then trying to convert it to an array, and then test with a for loop whether each character in the array is lowerCase or not. How can I achieve this? Here is how far I have gotten: ``` var input = "The quick BroWn fOX jumpS Over tHe lazY DOg" var inputArray = Array(input) for character in inputArray { /* if character is lower case { make it uppercase } else { make it lowercase } */ } ```

Original source