September 6, 20178 yr I am converting field names to values in a text field. Field names are similar to: FacilitySizeApproxImpervious For the data, I want: Facility Size Approx Impervioius What is the best way to identify the capital letter and add a space before it (but obviously not the first capital letter)? Thank you for any assistance. By the way, I have this started: Let ( field = table::FieldName Substitute ( field ; [ "A" ; " A" ] ; [ "B" ; " B" ] ; [ "C" ; " C" ] But I wonder if there is a better way and that also replaces the first one.
September 6, 20178 yr I don't think there's a shorter way = Trim ( Substitute ( text ; ["A" ; " A" ] ; ["B" ; " B" ] ; ["C" ; " C" ] ; ["D" ; " D" ] ; // ... ["X" ; " X" ] ; ["Y" ; " Y" ] ; ["Z" ; " Z" ] ) ) Hopefully you don't have any accented or Greek capital letters. Edited September 6, 20178 yr by comment
September 6, 20178 yr Author 27 minutes ago, comment said: Hopefully you don't have any accented or Greek capital letters. Since they are field names, there shouldn't be; same with $# etc. I anticipate the Users will have to review and correct some of them anyway but I want them to have a good start on the basic 'question labels.'
September 6, 20178 yr 49 minutes ago, comment said: I don't think there's a shorter way Well, that is unless you're willing to use a plugin: BE_RegularExpression ( "AlphaBravoCharlie" ; "(\p{Lu})" ; "g" ; " $1" ) will return: " Alpha Bravo Charlie" and will recognize any uppercase characters, in any language.
September 6, 20178 yr Author WOW. I hadn't created the calc yet and I am very willing to use Base Elements plugin since we use it all the time! YOU ROCK! That worked perfectly!
September 7, 20178 yr Even better = BE_RegularExpression ( "AlphaBravoÇharlie" ; "(\p{Ll})(\p{Lu})" ; "g" ; "$1 $2” ) returns: "Alpha Bravo Çharlie" Basically, this looks for a lowercase character (excluding punctuation and digits) followed by an uppercase one, and inserts a space between them. Edited September 7, 20178 yr by comment
Create an account or sign in to comment