Convert Array double to char ?

 

Hi,

I need to convert array double to char, how can I do?

DoubleToStr ?

Thank you

 

There is no char, but there is type string

So, yes, use DoubleToStr() and read the documentation.

 

Are you saying you have an Array which holds values of type double and you wish to convert the 8 Byte internal representation of a double to 4 Byte internal representation of a literal of whch only 0-255 have any meaning?

or you want to display the numbers held in the array of type double as strings you can read?

 
cello23: I need to convert array double to char, how can I do?

Not compiled, not tested.
string ArrayToStr.separator=",";
string ArrayToStr(double A[], int digits, int iStart=0, int nElem=WHOLE_ARRAY){
    if (nElem == WHOLE_ARRAY)  nElem == ArraySize(A) - iStart;
    string output = "";
    for (int iA = iStart; nElem > 0; iA++, nElem--){
        if (iA != iStart)   output = output + ArrayToStr.separator;
        output = output + DoubleToStr(A[iA], digits);
    }
    return(output);
}
double v[]={1,2,3}; string result = ArrayToStr(v,1); // result="1.0,2.0,3.0"
Not compiled, not tested.
 

Sorry Guys!! the question is not clear....

I have this array={1,2,3} i need to have this result = {"1","2","3"}

And, pleae another question:

is it possibile have an array like this result = {"1","2",3} ?

Thank's you

 
cello23:

is it possibile have an array like this result = {"1","2",3} ?


No. string or int, not a mix . .
 
cello23: I have this array={1,2,3} i need to have this result = {"1","2","3"}
int array[]={1,2,3}; int nArray = ArraySize(array);
string result[];     ArrayResize(result, nArray);
for (int iEle=0; iEle < nArray; iEle++) result[iEle] = DoubleToStr(array[iEle], d);
// i need to have this result = {"1","2","3"} 
Reason: