Update to use StrBuf

Complete newbie here. I'm not sure if my changes are idiomatic but it looks like the examples compile.