I am looking for suggestions on the best approach to Concatenate names of people I have stored in $Full Name. For example
John Smith → JohnSmith
Johnny Appleseed → JohnnyAppleseed
Bob Seger → BobSeger
Thanks
Tom
I am looking for suggestions on the best approach to Concatenate names of people I have stored in $Full Name. For example
John Smith → JohnSmith
Johnny Appleseed → JohnnyAppleseed
Bob Seger → BobSeger
Thanks
Tom
concatenate where, in what context. In action code, to another attribute $ConCatName:
$ConCatName = $FullName.replace(" ","");
Also, is it really only spaces we’re worried about, or all non A-Z characters, as there may be periods and hyphens to consider, for example. Are accented characters OK?
HTH
Hi Mark
Thank you.
Yes, you bring up a good point I did not consider, “Also, is it really only spaces we’re worried about, or all non A-Z characters, as there may be periods and hyphens to consider,”
How would I also exclude these Non A-Z and a-z characters in the code?
Happy Easter
Tom
OK, so what is this string needed for. IOW, what is the constraint we are embracing here? For what will the new concatenated string be used. If we work back from the constraints (max number of characters, limited characters set, etc.) if may avoid having to re-do the code.
If the aim is to have a form of UID, consider this when stripping spaces and other non-A–Z:
“John A Smith” → “JohnASmith”
“John Asmitth” → “JohnAsmith”
In a case insensitive comparison, the two are the same despite different source string.
Ah…I see what you mean. Yes, it is a form of UID and case insensitive.
Tom
So where/how are these UIDs to be used? Have you considered using underscores for spaces instead of removing them completely. Seeing how the concatenated string is used, i.e. as used in code, might help us give you a bigger steer.
If you want a person ID, whey not simply give them one. An easy way in a single TBX is to use $ID as it will be a unique 10-digit term for each person which won’t change.
Want to use the same UID across several documents? In the primary source, in each person note (e.g. via a prototype) set a user String $PersonID thus:
$PersonID = "p"+$ID
Do this one, in your master document and then you can re-use the notes in other TBXs too. always use the master doc to make new person note IDs as this ensures the $ID source is unique as it is drawn from the same TBXs pool of IDs.