Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2646 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted (edited)

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 by comment
  • Like 1
Posted
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.'  

Posted
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.

 

  • Like 1
Posted

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!  :smile3:

That worked perfectly!

Posted (edited)

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 by comment
  • Like 1

This topic is 2646 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.