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. The Lounge
  3. Why String?

Why String?

Scheduled Pinned Locked Moved The Lounge
comquestion
70 Posts 49 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.
  • A AspDotNetDev

    I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate. If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)? Any theories as to why "string" prevailed?

    Thou mewling ill-breeding pignut!

    U Offline
    U Offline
    User 8102478
    wrote on last edited by
    #46

    Has to do with the internal representation. A string is an array of char. A number (int, float etc) is a 4-64 byte binary. A string is typically though of as variable length, whereas a number is a definite size. To look at a number as a sequence of digits, you are actually converting from a binary representation to a string. That sequence of digits is a sequence of char, which is to say its actually a string.

    1 Reply Last reply
    0
    • A AspDotNetDev

      I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate. If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)? Any theories as to why "string" prevailed?

      Thou mewling ill-breeding pignut!

      U Offline
      U Offline
      User 8230845
      wrote on last edited by
      #47

      I've been programming since 1979 and that is always how I heard it pronounced "A-Sting" I also to this day call the $ a String and the ! a Bang etc.

      1 Reply Last reply
      0
      • E englebart

        The next project I start or join on the "ground floor" will ban String/Text as a datatype. Everything declared as a String could and should have a more descriptive data type. Which API is more descriptive? assign(String, String) OR assign(EmployeeId, DepartmentId)

        A Offline
        A Offline
        aojepojefpoejafpeoj
        wrote on last edited by
        #48

        Right, because assign(int, int) or creating a wrapper for string named EmployeeId is much better.

        1 Reply Last reply
        0
        • A AspDotNetDev

          I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate. If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)? Any theories as to why "string" prevailed?

          Thou mewling ill-breeding pignut!

          M Offline
          M Offline
          Member 8348554
          wrote on last edited by
          #49

          Why a duck? brian

          1 Reply Last reply
          0
          • L Lost User

            Back in the day, Computers were made of rope and wood , and each character was knotted onto a length of string. Sometimes the string would unravel. Hence the early programmers mantra - did it compile? I'm a frayed knot.

            MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

            K Offline
            K Offline
            Kythen
            wrote on last edited by
            #50

            You know what makes that even more amusing? You're actually correct! The ancient Inca used knotted strings called quipu[^] as a sort of calculator. :cool:

            L 1 Reply Last reply
            0
            • R Roger Wright

              I think it's an unconscious desire to return to the good old days of BASIC where a variable was identified as containing text characters by using the suffix $. The art of programming has never recovered from the damage done by constructs like, >10 DATA "MY", "TEXT", "DATA" >20 READ A$, B$, C$ >30 LPRINT A$, B$, C$ >50 GOTO 10 >9999 END >RUN Back in the day, A$ was even pronounced, "A-string." :-D

              Will Rogers never met me.

              M Offline
              M Offline
              MSBassSinger
              wrote on last edited by
              #51

              Sounds like string theory. :)

              R C 2 Replies Last reply
              0
              • A AspDotNetDev

                I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate. If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)? Any theories as to why "string" prevailed?

                Thou mewling ill-breeding pignut!

                J Offline
                J Offline
                jeramyRR
                wrote on last edited by
                #52

                I thought it was called String because we are "stringing" along characters. Since it's really an array of single characters, that makes sense to me.

                1 Reply Last reply
                0
                • V V 0

                  I use it because it reminds me of something else[^]...

                  V.

                  F Offline
                  F Offline
                  fred_
                  wrote on last edited by
                  #53

                  NOT WORK SAFE

                  1 Reply Last reply
                  0
                  • D DarkTizzy

                    Absolutely A-String FTW! Although I much prefer G$. :cool:

                    R Offline
                    R Offline
                    Ralph Little
                    wrote on last edited by
                    #54

                    Perhaps it is a US thing. I cut my programming teeth on a Vic20 and it was always A-dollar. I've never heard the A-string version in my entire 30 year experience in the industry (not that I would have heard either version in the last 25 of them, of course :D )

                    G M A 3 Replies Last reply
                    0
                    • A AspDotNetDev

                      Thanks, I can't get tied up at the moment.

                      Thou mewling ill-breeding pignut!

                      R Offline
                      R Offline
                      Ralph Little
                      wrote on last edited by
                      #55

                      I would have thought they you people would have COTTONED on to how tiresome this THREAD is becoming. :D

                      L 1 Reply Last reply
                      0
                      • A AspDotNetDev

                        I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate. If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)? Any theories as to why "string" prevailed?

                        Thou mewling ill-breeding pignut!

                        I Offline
                        I Offline
                        Indrora
                        wrote on last edited by
                        #56

                        AspDotNetDev wrote:

                        I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate.

                        you have to take into consideration the fact that string refers to a very specific thing, depending on the language:

                        • A sequence of chars, terminated in a NULL(0x00)
                        • A sequence of chars, pre-pended with their length as a uint8(This is how Pascal and .NET BinaryReaders do it)
                        • A fixed-width space that is assumed to have character data in it (MySQL VARCHAR)
                        • an N-Length columnar space containing character data (SQLite's TEXT field)
                        • a String literal, in C* defined as a sequence of characters wrapped in '"'.
                        • a Verbatim String in C#, allowing for '\n' and other punctuation to be preserved.
                        • A descriptive element attached to an object (Z-Code/Inform)

                        String, I feel, is used to encompass more of an idea, since "text" is ambiguous (is it a certain length? A certain kind? UTF?

                        AspDotNetDev wrote:

                        If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)?

                        Because ints aren't strings of numbers. Sure, in TCL and a few other languages, things are natively strings, but that counts only for convencience (and in the case of TCL, efficiency). In C* languages (this includes Java, Python, etc), int and float are stashed as their binary values -- the value 128 isn't stored as "128" -- its as 0x80. If we did store them as chars, think of how much memory it would take to store the Uint64 maximum value: 18,446,744,073,709,551,615 (thanks, MSDN!). That's 0xFFFFFFFFFFFFFFFF in hex, a much, much smaller value in-memory.

                        ---- "Pinky, are you thinking what im thinking?" "I Dunno brain, how many licks DOES it take to get to the tootsie roll center of a tootsie pop?" "You want me to calculate that? or should we take over the world?" "ooh! OooooOOOooH! lets find out!"

                        1 Reply Last reply
                        0
                        • A AspDotNetDev

                          I was just thinking that it seems a bit odd that "string" is so commonly used by programmers to refer to some text. I would think "text" would be more appropriate. If we are using "string" just because it refers to a string of characters (aka, a sequence of characters), then why not also call numbers "strings" (as they are strings/sequences of digits and some other characters)? Any theories as to why "string" prevailed?

                          Thou mewling ill-breeding pignut!

                          H Offline
                          H Offline
                          Harley L Pebley
                          wrote on last edited by
                          #57

                          A couple theories on StackOverflow[^] The two prevailing ones indicate it's either from typography or mathematics.

                          M 1 Reply Last reply
                          0
                          • R Ralph Little

                            Perhaps it is a US thing. I cut my programming teeth on a Vic20 and it was always A-dollar. I've never heard the A-string version in my entire 30 year experience in the industry (not that I would have heard either version in the last 25 of them, of course :D )

                            G Offline
                            G Offline
                            George Grimes
                            wrote on last edited by
                            #58

                            To add to the old-timers theory, I started programming in 1976 on my job. The first language was an assembler for a minicomputer and then Fortran. After that, I started to college working on my E.E. degree and they forced me to take one semester each of Basic and Fortran (again). By that time I was learning both Pascal and C at work so my exposure to Basic didn't do me too much harm. You can count me as another programmer (still programming for a living) who did not start with the Basic language. I also never heard A$ pronounced A-string until I read this thread. I also never considered Basic to have given birth to the concept of the terminology. I'll see if I can did out some of my old books and find any references to strings that predate Basic.

                            K 1 Reply Last reply
                            0
                            • M MSBassSinger

                              Sounds like string theory. :)

                              R Offline
                              R Offline
                              Roger Wright
                              wrote on last edited by
                              #59

                              It is, and yet, it isn't. There's a bit of uncertainty. ;)

                              Will Rogers never met me.

                              1 Reply Last reply
                              0
                              • K Kythen

                                You know what makes that even more amusing? You're actually correct! The ancient Inca used knotted strings called quipu[^] as a sort of calculator. :cool:

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #60

                                hence the ancient Inca saying, "Get Knotted"

                                MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                M 1 Reply Last reply
                                0
                                • R Ralph Little

                                  I would have thought they you people would have COTTONED on to how tiresome this THREAD is becoming. :D

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #61

                                  Get knotted

                                  MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                  1 Reply Last reply
                                  0
                                  • M MSBassSinger

                                    Sounds like string theory. :)

                                    C Offline
                                    C Offline
                                    Cj Welborn
                                    wrote on last edited by
                                    #62

                                    No one has anwered the original question

                                    1 Reply Last reply
                                    0
                                    • R Ralph Little

                                      Perhaps it is a US thing. I cut my programming teeth on a Vic20 and it was always A-dollar. I've never heard the A-string version in my entire 30 year experience in the industry (not that I would have heard either version in the last 25 of them, of course :D )

                                      M Offline
                                      M Offline
                                      Milton N
                                      wrote on last edited by
                                      #63

                                      To me A$ was always spoken as "A dollar" but it was always understood it as, this is a string variable. Maybe an AU thing :)

                                      1 Reply Last reply
                                      0
                                      • L Lost User

                                        hence the ancient Inca saying, "Get Knotted"

                                        MVVM# - See how I did MVVM my way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

                                        M Offline
                                        M Offline
                                        Milton N
                                        wrote on last edited by
                                        #64

                                        Seems we have been Strung along for too long...... :zzz:

                                        1 Reply Last reply
                                        0
                                        • H Harley L Pebley

                                          A couple theories on StackOverflow[^] The two prevailing ones indicate it's either from typography or mathematics.

                                          M Offline
                                          M Offline
                                          Milton N
                                          wrote on last edited by
                                          #65

                                          A string of pearls A string of beads A string of characters ... why not!

                                          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