Case Conversion Regular Expression in JAVA 8
-
Hi Community, I have come to the conclusion that it may not to be possible to change the case of a string in JAVA 8 as simply as it is to change the case in say Perl. However, before I move on, I just wanted to have someone on this forum confirm its not possible to change the case in JAVA 8 as follows: Insert the whole regex match or the 1st through 99th backreference with the first letter of each word in the matched text converted to uppercase and the remaining letters converted to lowercase. Example Replacing .+ with \I0 in HeLlO WoRlD yields Hello World Can someone confirm that the above isn't possible with JAVA 8? If its not possible, can someone let me know how to achieve the above with JAVA 8? Thanks
-
Hi Community, I have come to the conclusion that it may not to be possible to change the case of a string in JAVA 8 as simply as it is to change the case in say Perl. However, before I move on, I just wanted to have someone on this forum confirm its not possible to change the case in JAVA 8 as follows: Insert the whole regex match or the 1st through 99th backreference with the first letter of each word in the matched text converted to uppercase and the remaining letters converted to lowercase. Example Replacing .+ with \I0 in HeLlO WoRlD yields Hello World Can someone confirm that the above isn't possible with JAVA 8? If its not possible, can someone let me know how to achieve the above with JAVA 8? Thanks
-
I suggested to you last week that it would be easier to use string functions to do what you want. Convert the entire string to lower case, then find each word beginning and convert the single letter to upper case.
Hey Richard, I was so fixated with the way I wanted to achieve the result that I didn't realise how easy it is to get the result using your suggestion. TBH, with your suggestion I can get the result just using SQL, converting the entire string to lower case (as you suggested) and using a simple SQL function (which I'm familiar with) to Capitalize each word. I literally would have saved myself 9 hours of trying to figure this out. Thanks man
-
I suggested to you last week that it would be easier to use string functions to do what you want. Convert the entire string to lower case, then find each word beginning and convert the single letter to upper case.
Thanks man