1 Reply Latest reply: Oct 26, 2012 12:20 AM by TPD-Opitz RSS

    RegExp

    scottjhn
      For a string of the formats:

      abc_def_ghl
      abcd_xyz
      abc_def_ghl_k
      or similar...

      I like to replace the "_char" with the uppercased char, for example:

      abc_def_ghl --> abcDefGhl

      abcd_xyz --> abcdXyz

      abc_def_ghl_k --> abcDefGhlK

      etc.

      What is the RegExp for it?


      Thanks
        • 1. Re: RegExp
          TPD-Opitz
          scottjhn wrote:
          I like to replace the "_char" with the uppercased char
          Allthough java supports back references with <tt>String.replaceAll()</tt> it seams not support to change this back reference in any way. So you could use <tt>String.split("_[a-z]")</tt> to loop over the ocurrences of your regular expression and change the matches to upper case.

          bye
          TPD