Question: I'd like to write a simple C# app to collect the output of a Zebra printer's magnetic card reader. (Model RW420) My only interface to the device is USB. The CPCL language specifies an `MCR` command for this purpose, but I cannot figure out how to issue this command to the printer via .NET. Neither the online documentation nor support staff can tell me. Does anyone have an idea?

Answer: 
```
function spacecamel(s){
    return s.replace(/([a-z])([A-Z])/g, '$1 $2');
}

```

spacecamel('somethingLikeThis')

// returned value: something Like This
If you don't care about older browsers (or don't mind using a fallback **reduce** function for them), this can split even strings like 'xmlHTTPRequest' (but certainly the likes of 'XMLHTTPRequest' cannot).

```
function splitCamelCase(str) {
        return str.split(/(?=[A-Z])/)
                  .reduce(function(p, c, i) {
                    if (c.length === 1) {
                        if (i === 0) {
                            p.push(c);
                        } else {
                            var last = p.pop(), ending = last.slice(-1);
                            if (ending === ending.toLowerCase()) {
                                p.push(last);
                                p.push(c);
                            } else {
                                p.push(last + c);
                            }
                        }
                    } else {
                        p.push(c.charAt(0).toUpperCase() + c.slice(1));
                    }
                    return p;
                  }, [])
                  .join(' ');
}

```