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: 
A solution that handles numbers as well:

```
function capSplit(str){
   return str.replace(
      /(^[a-z]+)|[0-9]+|[A-Z][a-z]+|[A-Z]+(?=[A-Z][a-z]|[0-9])/g,
      function(match, first){
          if (first) match = match[0].toUpperCase() + match.substr(1);
          return match + ' ';
          }
       )
   }

```

[Tested here [JSFiddle, no library.](http://jsfiddle.net/xh3HT/) Not tried IE]; should be pretty stable.
Not regex, but useful to know plain and old techniques like this:

```
var origString = "thisString";
var newString = origString.charAt(0).toUpperCase() + origString.substring(1);

```