Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Remove double from string and store in an array

  • 13-09-2009 4:07pm
    #1
    Registered Users, Registered Users 2 Posts: 46


    Hi folks,
    I have a string that will be different each time but follow the form of
    -3.33,-46.53,37.39,26.55,97.11,68.46,-32.46,-5.89,-62.89,-7.9,
    and i want to remove each number and store as an double in an array.
    even pseudocode would be great i'm drawing a blank.
    Cheers


Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    You mean something like this?
    string input = "-3.33,-46.53,37.39,26.55,97.11,68.46,-32.46,-5.89,-62.89,-7.9,";
    
    string arrInput[] = input.split(",");
    
    double arrOutput[] = new array of doubles;
    
    for (int i = 0; i < arrInput.length; i++)
    {
        double myNum = ConvertToDouble(arrInput[i]);
        arrOutput[i] = myNum;
    }
    


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Well?


  • Registered Users, Registered Users 2 Posts: 46 neonic75


    Hi Eoin,
    Sorry you'll have to pardon my ignorance for not posting back, i've been flat out. That worked perfectly. thanks.
    Cheers


Advertisement