Re: Creating Full Name from given, initials, sn, when some might be null



Thanks for your suggestion - I like your version better than mine!

On 27 Feb, 16:54, "H. S. Lahman" <h.lah...@xxxxxxxxxxx> wrote:
Responding to Ssg31415926...

This forum is usually concerned with OOA/D issues rather that tactical
coding practices in particular OOPLs, so you might get a better answer
in the appropriate language or programming forum. But as long as we're
here...

You could make it more compact by making the string operations generic
(using appropriate syntax for whatever language you are using):

static String nameIdentifiers [3] = {"GivenName", "initials", "sn"};
StringBuilder sb = new StringBuilder();
bool previousValueSet = FALSE;
for (i = 0; i < 3; i++)
{
if (src[0].Properties[nameIndentifiers[i]].Count > 0)
{
if (previousValueSet)
sb.Append(" ");
sb.Append(src[0].Properties[nameIdentifiers[i]][0].ToString());
previousValueSet = TRUE;
}

}

*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
h...@xxxxxxxxxxxxxxxxx
Pathfinder Solutionshttp://www.pathfindermda.com
blog:http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
i...@xxxxxxxxxxxxxxxxx for your copy.
Pathfinder is hiring:http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH


.



Relevant Pages

  • Re: CLtL2 copyright question
    ... lot more conservative about what I'm willing to say in a casual forum. ... doesn't match the CL spec in semantics. ... personal description of a language that isn't even the one you could ... Common Lisp needs a publicly-modifiable specification for many reasons, of which here are a few examples. ...
    (comp.lang.lisp)
  • Re: ELF loading
    ... alt.lang.asm will address the problems of machine language programmers ... questions about asm in relation to windows, will naturally involve the API and how to do thing with it. ... The only place an asmer should fall to post is in a text only forum. ...
    (alt.lang.asm)
  • Re: ELF loading
    ... since DOS and BIOS and the windows API ... I think DirectShow and Direct3D become replaced when upgrading directX. ... sure that if all we did was posting on asm language itself, ... only place an asmer should fall to post is in a text only forum. ...
    (alt.lang.asm)
  • Re: Petition again MS
    ... ¤ all you were doing was taunting him. ... the VB6 forum. ... knowledge to use another language and is at home with interop. ... complex or obscure question to multiple forums ...
    (microsoft.public.vb.general.discussion)
  • Re: What are you reading?
    ... three novels. ... Very interesting reading. ... I like the language, and I like his style, but I ... is an internet forum the closest you've ever been to reading ...
    (alt.smokers.pipes)