     
     var mutableFormat = format
     
-    while mutableFormat.characters.count > 0 {
+    while !mutableFormat.isEmpty {
         
         let c = mutableFormat.remove(at: mutableFormat.startIndex)
         

    
    mutableFormat.remove(at: mutableFormat.startIndex) // consume byte-order specifier
    
    while mutableFormat.characters.count > 0 {
        
        let c = mutableFormat.remove(at: mutableFormat.startIndex)
        


func isBigEndianFromMandatoryByteOrderFirstCharacter(_ format:String) -> Bool {
    
    guard let firstChar = format.first else { assertionFailure("empty format"); return false }
    
    let s = NSString(string: String(firstChar))
    let c = s.substring(to: 1)
