Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Saving long number strings in project data

edited July 2014 in Bugs Posts: 19

Hi, I just encountered this issue with project data:

saveProjectData("test", "01000101001010000001010111100010101")
print(readProjectData("test"))

This outputs 1.0001009639802e+33, which means that number strings are saved as numbers instead of strings.

The only solution I have at the moment is to add a textual prefix, but that is really annoying. Shouldn't strings be saved as strings?!

Comments

  • IgnatzIgnatz Mod
    Posts: 5,396

    @jfperusse - I think everything is saved as strings, it is when it is loaded back that the problem occurs

  • edited July 2014 Posts: 127

    Why don't you try

    saveProjectData("test", "01010010101000011010101000010")
    strdat = tostring(readProjectData("test"))
    print(strdat)
  • edited July 2014 Posts: 127

    Just a question... Is the string class immutable?

  • dave1707dave1707 Mod
    Posts: 7,554

    @aurumcoder2624 If you would have tried the code you suggested, you would have seen that it has the same problem as the original post.

  • I know, but tostring makes the data a string, so the problem is blocked.

    Fine, I agree with u. :-L

  • Posts: 1,976

    I had this problem while attempting to save passcodes in my unsuccessful ( :| ) passcode project. I have to make do with file IO, as global data, local data, and project data all seem to treat a string of numbers and numbers instead of strings.

    The e+ stuff is scientific notation, it's used to shorten long numbers.

  • dave1707dave1707 Mod
    Posts: 7,554

    @jfperusse One way around the problem is to put a letter as the first character of the string. You can then remove the letter after you read the data back.

  • Posts: 2,042

    Did you try saveProjectData(tostring(10101010101010101010101010101000001))

    I haven't tried it but if the problem is that it is being saved as a number this might help? otherwise you could do it how Sky does.

  • Posts: 19

    @JakAttak, yes, I tried this.

    @dave1707, that's exactly what I meant by "The only solution I have at the moment is to add a textual prefix" ;) That's the solution I am using now.

  • dave1707dave1707 Mod
    Posts: 7,554
  • Posts: 19

    @dave1707, thanks! Interestingly, Simeon said he fixed it, and that was in 2012 :/

  • dave1707dave1707 Mod
    Posts: 7,554

    @Simeon Can you look at this then look at the link I have above to a previous Sept 2012 discussion.

Sign In or Register to comment.