 
                             if (estate == .ScanningVarName) {
                                 if (j == "*" || j == ":") {
-                                    if countElements(varName) == 0 {
+                                    if varName.isEmpty {
                                         eError = .MalformedVarSpec
                                         break;
                                     }

                        // Skip the operator
                        var skipCount = 0
                        if operator {
                            if expression[expression.startIndex] == "%" {
                                skipCount = 3
                            } else {
                                skipCount = 1

    case MalformedVarSpec
}

/*!
* @discussion
* This class is an implementation of URI Template (RFC6570). You probably
* wouldn't need to use this class but the convenient function ExpandURITemplate.
*/
public class URITemplate {
    enum State {
        case ScanningLiteral
