- Of course, it does. Your newSymbols[] is empty; zero size.
- It is unnecessary.
void _CleanArrayIFsomeEmpty(string& Arry[]) { ArrayResize(array, remove_copy(Arry, 0, ArraySize(Arry), Arry, 0, "") ); } #define INDEX uint template<typename Ti, typename To> INDEX remove_copy(const Ti& inp[], INDEX iBeg, INDEX iEnd, To& out[], INDEX oBeg, const Ti& value){ for(; iBeg != iEnd; ++iBeg){ if(!(inp[iBeg] == value) ) out[oBeg++] = inp[iBeg]; } return oBeg; }
thanks for rply but not understund your code , i try to test your code but return many error
'array' - undeclared identifier common_functions.mqh 2088 17 '' - parameter passed as reference, variable expected common_functions.mqh 2088 71 '' - parameter passed as reference, variable expected common_functions.mqh 2088 71 '' - parameter passed as reference, variable expected common_functions.mqh 2088 71 'array' - parameter conversion not allowed common_functions.mqh 2088 17 'array' - array required common_functions.mqh 2088 17
thanks for rply but not understund your code , i try to test your code but return many error
i correct the code in this mode and now go
void _CleanArrayIFsomeEmpty(string& Arry[]) { const string de=""; ArrayResize(Arry, remove_copy(Arry, 0, ArraySize(Arry), Arry, 0, de) ); } #define INDEX int template<typename Ti, typename To> INDEX remove_copy(const Ti& inp[], INDEX iBeg, INDEX iEnd, To& out[], INDEX oBeg, const Ti& value) { for (; iBeg != iEnd; ++iBeg) { if (!(inp[iBeg] == value)) out[oBeg++] = inp[iBeg]; } return oBeg; }thanks so much @William Roeder
sorry if i resurected this topic, but i notice the function not work, remaning a blank record
i have array with 10 record , the first and the last is blank(but could be at middle), i want remove the blank record and transform array in size in 8 (and the second record will be a first )
how is possible to do that ???
sorry if i resurected this topic , but i notice the function not work , remaning a blank record
i have array with 10 record , the first and the last is blank(but could be at middle), i want remove the blank record and transform array in size in 8 (and the second record will be a first )
how is possible to do that ???
i write up
void _CleanArrayIFsomeEmpty(string& Arry[]) { const string de=""; Print("cane di pio nono "+ ArraySize(Arry)); ArrayResize(Arry, remove_copy(Arry, 0, ArraySize(Arry), Arry, 0, de) ); Print("cane di gesu morto "+ ArraySize(Arry)); } #define INDEX int template<typename Ti, typename To> INDEX remove_copy(const Ti& inp[], INDEX iBeg, INDEX iEnd, To& out[], INDEX oBeg, const Ti& value) { for (; iBeg != iEnd; ++iBeg) { if (!(inp[iBeg] == value)) out[oBeg++] = inp[iBeg]; // Print ("cane di dio---->" +inp[iBeg]); } return oBeg; }
i tried also in this mode but nothing, return 12 :(((((
// Funzione per rimuovere i record vuoti da un array di stringhe void RemoveEmptyRecords(string &array[]) { string newArray[]; int newSize = 0; for (int i = 0; i < ArraySize(array); i++) { if (StringLen(array[i]) > 0) { ArrayResize(newArray, newSize + 1); newArray[newSize] = array[i]; newSize++; } } ArrayCopy(array, newArray); } // Esempio di utilizzo della funzione void OnStart() { string myArray[] = {"", "AUDUSD", "AUDJPY", "", "NZDJPY", "AUDJPY", "GBPAUD", "EURUSD", "EURAUD", "EURGBP", "EURUSD", ""}; RemoveEmptyRecords(myArray); Print("Array senza record vuoti: ", ArraySize(myArray)); }
i try also in this mode but arraCpy not copy :(((
// Funzione per rimuovere i record vuoti da un array di stringhe void RemoveEmptyRecords(string &array[]) { string newArray[]; for (int i = 0; i < ArraySize(array); i++) { if (StringLen(array[i]) > 0) { ArrayResize(newArray, ArraySize(newArray) + 1); newArray[ArraySize(newArray) - 1] = array[i]; } } ArrayFree(array); ArrayResize(array,ArraySize(newArray),ArraySize(newArray)); ArrayCopy(newArray, array); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guy i have one array with 10 record but the first and last is empty i want remove this record how possible to do that ?
i have crete this code but return array overflow therefore i think i have some mistake
anyone can help me ?? thanks