Tstring 's and their data types

This is a discussion on Tstring 's and their data types within the C++ Programming forums, part of the General Programming Boards category; just started using tstringlist over arrays... and uh.... how would i make it so the TStringlist treats the values it ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    93

    Question Tstring 's and their data types

    just started using tstringlist over arrays... and uh.... how would i make it so the TStringlist treats the values it is holding as 'double'.

    I want to do mathematical operations with data in the TStringList.

    currently all my numbers going in are treated as AnsiString and when it comes to sorting this TString it doesn't work to well...

    any ideas floating around out there?..?

    ill attach my current program if anyone wants to see what i'm trying to do...its only about half done... i can sort 3 of the 4 columns.. but the size one with the numbers is pretty screwed up... saveas partially works... open works, new works, add item button works,, and all sort buttons work except size one...rest of program non-functional...

    any comments would be appreciated.... if you haven't figured out it catalogs a persons CD collection...for those crazy burners like me
    Attached Files Attached Files

  2. #2
    Unregistered
    Guest
    AnsiSting and TString are string classes (the same ones known by different names if I remember correctly). If they don't have member functions to do conversions for you, you can always to this:

    AnsiString string1 = "1.023";

    //convert c_style string buried in AnsiString to float using atof()
    float number = atof(string1.c_str());

    //cast float to double
    double num = (double)number;

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    93

    thnx

    thnx... ill try er' out and see how she works.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21