Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Austin Danger Powers

Austin Danger Powers

Scheduled Pinned Locked Moved The Weird and The Wonderful
38 Posts 17 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Fabio Franco

    AspDotNetDev wrote:

    companies can send you emails and address you by your first name

    someString.Split(' ')[0];

    AspDotNetDev wrote:

    let the user know that all portions of the name must be entered

    lblName.Text = "Full Name:"

    I know that name splitting has it's usefulness, like displaying in formats like "Last, First Name" the way the user wants, but I believe single field names benefits outweighs by far the benefits of multiple field names. Not only on the functional perspective, but also on development. It's much simpler to have only one column on the database to hold a name. A better solution would indeed be a toggle, but then, that adds overhead to development.

    A Offline
    A Offline
    AspDotNetDev
    wrote on last edited by
    #28

    How would your code handle a user who enters: "Mr. Fabio Franco, Ph.D."? :) Or how about these:

    • "Mr Fabio Franco, Phd"
    • "Mr Fabio Franco the first, phd cna"
    • "Mrs. Fabio Franco"
    • "Fabio Franco, Mr"
    • "Fabio Franco III"
    • "Fabio"

    There is quite a bit of variation out there, and I'm sure more variation I don't know about in other cultures. Users do funny things when you let them (try to) think for themselves.

    Flummery:

    This is not the age of reason, this is the age of flummery, and the day of the devious approach. Reason’s gone into the backrooms where it works to devise means by which people can be induced to emote in the desired direction.

    F 1 Reply Last reply
    0
    • A AspDotNetDev

      How would your code handle a user who enters: "Mr. Fabio Franco, Ph.D."? :) Or how about these:

      • "Mr Fabio Franco, Phd"
      • "Mr Fabio Franco the first, phd cna"
      • "Mrs. Fabio Franco"
      • "Fabio Franco, Mr"
      • "Fabio Franco III"
      • "Fabio"

      There is quite a bit of variation out there, and I'm sure more variation I don't know about in other cultures. Users do funny things when you let them (try to) think for themselves.

      Flummery:

      This is not the age of reason, this is the age of flummery, and the day of the devious approach. Reason’s gone into the backrooms where it works to devise means by which people can be induced to emote in the desired direction.

      F Offline
      F Offline
      Fabio Franco
      wrote on last edited by
      #29

      I get what you mean, users thinking by themselves are not good :~, but I think design can solve those issues :) : Title: Full Name: Again, it works so well here that I'm still to find a place in .com.br domain that asks for a multi field name. I don't there's magic bullet for anything, but I still believe that my argument stands, that single field names benefits outweighs multi-field names. I think in US is more of a culture of "most do this way, so we're not changing", although I've seen several single field name cases already.

      1 Reply Last reply
      0
      • _ _Erik_

        AspDotNetDev wrote:

        I wasn't sure if I should put this in "Clever Code" or "Hall of Shame".

        Hall of shame, definitely, specially considering that this line would do the same job:

        Return String.Format("{0} {1} {2}", firstName, middleName, lastName).Replace(" ", " ").Trim()

        Yes, it works even if firstName, middleName and/or lastName are null. Edit: Forgot the Replace

        T Offline
        T Offline
        TorstenFrings
        wrote on last edited by
        #30

        You missed the condition, that the middle name should be omitted if first or last is missing... :cool:

        A 1 Reply Last reply
        0
        • L Luc Pattyn

          There is a small change in the specs, we now have two more optional (middle?) initials. Please adapt your code... :)

          Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

          B Offline
          B Offline
          BobJanova
          wrote on last edited by
          #31

          Yeah, while the forename-surname thing is kind of fair enough for many applications (most of us do work in English language countries), even in those, lots of people have more than one middle name.

          1 Reply Last reply
          0
          • A AspDotNetDev

            Private Function GetFullName(firstName As String, middleName As String, lastName As String) As String

            ' Variables.
            Dim fullName As String
            Dim firstEmpty As String = String.IsNullOrEmpty(firstName)
            Dim middleEmpty As String = String.IsNullOrEmpty(middleName)
            Dim lastEmpty As String = String.IsNullOrEmpty(lastName)
            
            
            ' Combine name parts into full name.
            If firstEmpty Then
            	If middleEmpty Then
            		' Powers.
            		fullName = lastName
            	Else
            		If lastEmpty Then
            			' Danger.
            			fullName = middleName
            		Else
            			' Powers (ignore middle name).
            			fullName = lastName
            		End If
            	End If
            Else
            	If lastEmpty Then
            		' Austin (ignore middle name).
            		fullName = firstName
            	Else
            		If middleEmpty Then
            			' Austin Powers.
            			fullName = String.Format("{0} {1}", firstName, lastName)
            		Else
            			' Austin Danger Powers.
            			fullName = String.Format("{0} {1} {2}", firstName, middleName, lastName)
            		End If
            	End If
            End If
            
            
            ' Return full name.
            Return fullName
            

            End Function

            I wasn't sure if I should put this in "Clever Code" or "Hall of Shame". :)

            Flummery:

            This is not the age of reason, this is the age of flummery, and the day of the devious approach. Reason’s gone into the backrooms where it works to devise means by which people can be induced to emote in the desired direction.

            J Offline
            J Offline
            Jassim Makki
            wrote on last edited by
            #32

            wahaha this a "Hall of Shame" code indeed XD

            1 Reply Last reply
            0
            • L Luc Pattyn

              There is a small change in the specs, we now have two more optional (middle?) initials. Please adapt your code... :)

              Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

              H Offline
              H Offline
              HaBiX
              wrote on last edited by
              #33

              lol

              1 Reply Last reply
              0
              • T TorstenFrings

                You missed the condition, that the middle name should be omitted if first or last is missing... :cool:

                A Offline
                A Offline
                AspDotNetDev
                wrote on last edited by
                #34

                Nope, if a middle name is all you have to call somebody, then you might as well call them that.

                Chris Maunder wrote:

                Fixign now.

                But who's fixing the fixign?

                T 1 Reply Last reply
                0
                • A AspDotNetDev

                  Nope, if a middle name is all you have to call somebody, then you might as well call them that.

                  Chris Maunder wrote:

                  Fixign now.

                  But who's fixing the fixign?

                  T Offline
                  T Offline
                  TorstenFrings
                  wrote on last edited by
                  #35

                  What I meant was: GetFullName(null, "middle", "last") => "last" GetFullName("first", "middle", null) => "first" isn't accomplished by your expression... but as well doesn't justify the code of horror in the OP

                  A 1 Reply Last reply
                  0
                  • T TorstenFrings

                    What I meant was: GetFullName(null, "middle", "last") => "last" GetFullName("first", "middle", null) => "first" isn't accomplished by your expression... but as well doesn't justify the code of horror in the OP

                    A Offline
                    A Offline
                    AspDotNetDev
                    wrote on last edited by
                    #36

                    Actually, I am the OP and I didn't catch that. Take some 5's. :thumbsup:

                    Chris Maunder wrote:

                    Fixign now.

                    But who's fixing the fixign?

                    1 Reply Last reply
                    0
                    • P Paladin2000

                      AspDotNetDev wrote:

                      Dim firstEmpty As String = String.IsNullOrEmpty(firstName)

                      String.IsNullOrEmpty returns "bool"... How are you assigning it to a string variable..? :confused:

                      D Offline
                      D Offline
                      DragonsRightWing
                      wrote on last edited by
                      #37

                      Timothy CIAN wrote:

                      String.IsNullOrEmpty returns "bool"... How are you assigning it to a string variable..? :confused:

                      I was wondering the same thing - the line shouldn't compile (and doesn't, when I test it)!

                      1 Reply Last reply
                      0
                      • L Luc Pattyn

                        Here it is pretty normal to have several "first names", in Dutch we actually call them firstnames (plural), although first, second, third, etc. would be more logical. I have four. So we don't really have a middle name or middle initial, when you ask me for a middle initial you'd get three of them. And all that is without double or composite names. How about the code? :)

                        Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                        Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                        B Offline
                        B Offline
                        Blake Miller
                        wrote on last edited by
                        #38

                        The multiple names is not SOOO uncommon here in the U.S.A. anymore either. The nanas were arguing about the middle name for our second daugher, so we just gave her "Amber Ann" as the middle name!

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups