@Override
            public String format(String str)
            {
                final StringBuilder buffer = toUnderscoreCase(str);
                char c = buffer.charAt(0);
                if (c > 96 && c < 123)
                    buffer.setCharAt(0, (char) (c - 32));

                for (int i = 1, len = buffer.length(); i < len; i++)
                {
                    if (' ' == (c = buffer.charAt(i)))
                    {
                        // move to the next
                        if (++i != len && (c = buffer.charAt(i)) > 96 && c < 123)
                            buffer.setCharAt(i, (char) (c - 32));

                        continue;
                    }

                    if (c == '_' && len != i + 1)
                    {
                        buffer.setCharAt(i, ' ');

                        c = buffer.charAt(i + 1);
                        if (c > 96 && c < 123)
                            buffer.setCharAt(++i, (char) (c - 32));
                    }
                }

                return buffer.toString();
            }
pascal-case with space in between.
<p>

<pre>
someFoo/some_foo/SomeFoo becomes "Some Foo"
</pre>
protostuff-compiler/src/main/java/io/protostuff/compiler/Formatter.java