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. Have I closed correctly...

Have I closed correctly...

Scheduled Pinned Locked Moved The Lounge
questioncareer
13 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.
  • G glennPattonPub

    Hi All, I asked a bit of an odd question on Friday about converting an integer to a string, using CP more as a rubber duck.. got caught with something else that went pop (real smoke!) and could give much attention to it. Came in this morning late (as I had to get the bus replacement, for the bus replacement for the rail replacement, don't ask!) to find the main job for today had been shelved due to non-delivery of parts. So I could get back to programming the widget I am working on and bingo! Now I need to close it... so it's not waiting...

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #2

    First, you have to be respectful of the integer's parents and talk to them about conversion. Then you need to take the integer to church every Sunday so they can talk to the stringy pastor. Most importantly, you cannot force it to convert. It has to be authentic and natural. But, if the integer hangs around enough strings, perhaps one day it'll see the light and realize a character representation of numbers that requires encoding is a much better means of representing data than a number that requires interpretation.

    Jeremy Falcon

    G 1 Reply Last reply
    0
    • J Jeremy Falcon

      First, you have to be respectful of the integer's parents and talk to them about conversion. Then you need to take the integer to church every Sunday so they can talk to the stringy pastor. Most importantly, you cannot force it to convert. It has to be authentic and natural. But, if the integer hangs around enough strings, perhaps one day it'll see the light and realize a character representation of numbers that requires encoding is a much better means of representing data than a number that requires interpretation.

      Jeremy Falcon

      G Offline
      G Offline
      glennPattonPub
      wrote on last edited by
      #3

      So that's where I've been going wrong! if integers go to see the stringy pastor, do floats just float around?

      J 1 Reply Last reply
      0
      • G glennPattonPub

        Hi All, I asked a bit of an odd question on Friday about converting an integer to a string, using CP more as a rubber duck.. got caught with something else that went pop (real smoke!) and could give much attention to it. Came in this morning late (as I had to get the bus replacement, for the bus replacement for the rail replacement, don't ask!) to find the main job for today had been shelved due to non-delivery of parts. So I could get back to programming the widget I am working on and bingo! Now I need to close it... so it's not waiting...

        honey the codewitchH Offline
        honey the codewitchH Offline
        honey the codewitch
        wrote on last edited by
        #4

        string num = "-5498";
        int pos = 0;
        int result = 0;
        int len = num.Length;
        bool neg = false;
        if(num[0]=='-') { ++pos; neg = true; }
        while(pos

        something like that?

        Check out my IoT graphics library here:
        https://honeythecodewitch.com/gfx
        And my IoT UI/User Experience library here:
        https://honeythecodewitch.com/uix

        G J 2 Replies Last reply
        0
        • G glennPattonPub

          So that's where I've been going wrong! if integers go to see the stringy pastor, do floats just float around?

          J Offline
          J Offline
          Jeremy Falcon
          wrote on last edited by
          #5

          Floats should go too, but they're stubborn so you'd have to double down. :-\

          Jeremy Falcon

          G 1 Reply Last reply
          0
          • honey the codewitchH honey the codewitch

            string num = "-5498";
            int pos = 0;
            int result = 0;
            int len = num.Length;
            bool neg = false;
            if(num[0]=='-') { ++pos; neg = true; }
            while(pos

            something like that?

            Check out my IoT graphics library here:
            https://honeythecodewitch.com/gfx
            And my IoT UI/User Experience library here:
            https://honeythecodewitch.com/uix

            G Offline
            G Offline
            glennPattonPub
            wrote on last edited by
            #6

            Nothing nearly that bomb proof, itoa(), as it a value from a sensor reality has issues if it's negative! (mind you checking to see if it's negative might be an idea... sensor can kick out negative if calibrates wrongly!)

            honey the codewitchH 1 Reply Last reply
            0
            • G glennPattonPub

              Nothing nearly that bomb proof, itoa(), as it a value from a sensor reality has issues if it's negative! (mind you checking to see if it's negative might be an idea... sensor can kick out negative if calibrates wrongly!)

              honey the codewitchH Offline
              honey the codewitchH Offline
              honey the codewitch
              wrote on last edited by
              #7

              To be fair, i can break what i wrote by feeding it non-numeric characters. I would say more quick and dirty than bomb proof. itoa() works, but it doesn't stream, which is why I've written the above code more times than i care to admit!

              Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

              1 Reply Last reply
              0
              • J Jeremy Falcon

                Floats should go too, but they're stubborn so you'd have to double down. :-\

                Jeremy Falcon

                G Offline
                G Offline
                Gary R Wheeler
                wrote on last edited by
                #8

                And your point is?

                Software Zen: delete this;

                J 1 Reply Last reply
                0
                • G Gary R Wheeler

                  And your point is?

                  Software Zen: delete this;

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #9

                  One can mantissapate that response. :rolleyes:

                  Jeremy Falcon

                  J P 2 Replies Last reply
                  0
                  • J Jeremy Falcon

                    One can mantissapate that response. :rolleyes:

                    Jeremy Falcon

                    J Offline
                    J Offline
                    jmaida
                    wrote on last edited by
                    #10

                    :) groan

                    "A little time, a little trouble, your better day" Badfinger

                    1 Reply Last reply
                    0
                    • J Jeremy Falcon

                      One can mantissapate that response. :rolleyes:

                      Jeremy Falcon

                      P Offline
                      P Offline
                      Peter_in_2780
                      wrote on last edited by
                      #11

                      Better than mansplaining it, I guess.

                      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                      1 Reply Last reply
                      0
                      • honey the codewitchH honey the codewitch

                        string num = "-5498";
                        int pos = 0;
                        int result = 0;
                        int len = num.Length;
                        bool neg = false;
                        if(num[0]=='-') { ++pos; neg = true; }
                        while(pos

                        something like that?

                        Check out my IoT graphics library here:
                        https://honeythecodewitch.com/gfx
                        And my IoT UI/User Experience library here:
                        https://honeythecodewitch.com/uix

                        J Offline
                        J Offline
                        jschell
                        wrote on last edited by
                        #12

                        OP says "integer to a string". Did I misread something in that or your code? And C# already has that for both directions.

                        honey the codewitchH 1 Reply Last reply
                        0
                        • J jschell

                          OP says "integer to a string". Did I misread something in that or your code? And C# already has that for both directions.

                          honey the codewitchH Offline
                          honey the codewitchH Offline
                          honey the codewitch
                          wrote on last edited by
                          #13

                          No, I misread something in the OP. :laugh: Int to string is even easier. Edit: C# can't stream to an arbitrary length integer off a textreader for example. That's why I've had to write the parsing code myself.

                          Check out my IoT graphics library here: https://honeythecodewitch.com/gfx And my IoT UI/User Experience library here: https://honeythecodewitch.com/uix

                          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