Forum Discussion

messengineer2's avatar
messengineer2
Frequent Visitor
4 years ago
Solved

Detecting position of Case Change within a String in Column of data

Hi All.
I have a series of thousands of User Names in a table column and the format is inconsistent and I am cleaning them up in M. 
So I am replacing things like "." with " " or "," with "" or changing all the strings which are entirely lowercase to Proper Case etc.
One of the remaining challenges is detecting where there is a change of Case and I want to add a space.
i.e. "SmithJ" I want to be changed to "Smith J" or "FredSmith" I want to be changed to "Fred Smith" to make the format consistent.
Since there are no wildcard options for case, and the position is completely random, struggling to think of a simple solution.
Any suggestions? Happy for a solution in either M or DAX.

Thanks in advance.

  • Text.Combine(Splitter.SplitTextByCharacterTransition({"a".."z"},{"A".."Z"})("SmithJ")," ")

4 Replies