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. General Programming
  3. C / C++ / MFC
  4. What are the advantages of a string table?

What are the advantages of a string table?

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 7 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.
  • D Offline
    D Offline
    Daniel1324
    wrote on last edited by
    #1

    Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

    O A Y M P 6 Replies Last reply
    0
    • D Daniel1324

      Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

      O Offline
      O Offline
      Oinka
      wrote on last edited by
      #2

      The advantage is it makes it easier for people to hack your code and make all the dialogs say stupid things. Oh wait... that's a disadvantage ;P

      1 Reply Last reply
      0
      • D Daniel1324

        Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

        A Offline
        A Offline
        Anthony_Yio
        wrote on last edited by
        #3

        For some developers. They would like to pack their resource files into a DLL. This is to allow different language version to be shipped easily by just changing the DLL instead of recompile the entire source code after changing the const String in the code line by line. Some developers would like to have their const string to be placed into INI files instead. Just some alternatives of doing the work. Sonork 100.41263:Anthony_Yio

        1 Reply Last reply
        0
        • D Daniel1324

          Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

          Y Offline
          Y Offline
          yndfcd
          wrote on last edited by
          #4

          Using string table, you can switch user interface between deferent languages. Is this an advantage?

          1 Reply Last reply
          0
          • D Daniel1324

            Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            One word: translation. When you put all UI elements into resources, you can translate them without touching any of the C code. This is an incredibly meaningful fact since it reduces the amount of testing required on the translated version. If you touch any code, it has to be (or should be, at least) retested to make sure no typos happened while changing all the string literals. It also lets a non-programmer translate the app. All they need is a resource editor. If you never plan on translating, then... *shrug* --Mike-- Ericahist [updated Oct 26] | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber Pinky, are you pondering what I'm pondering? I think so Brain, but if we shaved our heads, we'd look like weasels!

            1 Reply Last reply
            0
            • D Daniel1324

              Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

              P Offline
              P Offline
              Pizzor2000
              wrote on last edited by
              #6

              Not to mention, if you ever have a need to change what a string says, it's easier to use the resource than search the code for the string definition. Every once in a while, I've wanted to modify a title or reword a message in one of my programs.

              1 Reply Last reply
              0
              • D Daniel1324

                Other than for repetitive strings. Whats the advantage of this... CString Str; Str.LoadString(IDS_STRING1); MessageBox(Str); Over this... MessageBox("This is a string."); (BTW: IDS_STRING1 = "This is a string.") ??? I dont see the advantages. Maybe somebody else can shed some light on the subject.

                A Offline
                A Offline
                Atlantys
                wrote on last edited by
                #7

                As people have said, for "easy" Internationalization and Localization of your strings. It also makes it easier if you decide to support UNICODE. I never hard-code strings, but if you're just writing some POS app then, maybe you don't want to use a string table. The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices. [Roger Wright on stupid people] We're like private member functions [John Theal on R&D] We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know... [Nitron]

                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