https://play.golang.org/p/-FM2wC22A0
My inclination would be to go for an approach like this. Then make a table-driven unit test and throw everything you can think of at it and iterate until you get what you need. On Sun, Sep 3, 2017 at 2:23 PM, Tong Sun <suntong...@gmail.com> wrote: > Hi, > > I need to split "CamelCaseWords" into individual words like "Camel Case > Words". > The following is the Perl code that I get for doing just that: > > @words = $words[0] =~ /[A-Z][^A-Z]*/g > if @words == 1 && $words[0] =~ /^[A-Z]/; > > However, I've been staring at it long enough to confirm myself that I > really don't quite understand how it was done. > > Anyway, I'm wondering what's the neat way to do it in Go. > > PS. if you must know, I know that the algorithm I can borrow from is > github.com/danverbraganza/varcaser, but when I was trying to use it, I > noticed a side effect that makes it works for "myConstantVariable" but not > for "GNU PYTHON Standard": > https://github.com/danverbraganza/varcaser/issues/1 > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.