//+------------------------------------------------------------------+ //| IncStrFunctions.mqh | //| Copyright 2012, Integer. | //| https://login.mql5.com/ru/users/Integer | //+------------------------------------------------------------------+ #property copyright "Integer" #property link "https://login.mql5.com/ru/users/Integer" //+------------------------------------------------------------------+ //| Deleting spaces at the ends of the string | //+------------------------------------------------------------------+ string Trim(string Str) { StringTrimLeft(Str); StringTrimRight(Str); return(Str); } //+------------------------------------------------------------------+ //| Searching for a substring starting from the end of the string | //+------------------------------------------------------------------+ int StringFindRev(string Str,string Find) { //--- the pos variable for the returned value int pos; //--- auxiliary variable initialized to -1, //--- in case the substring is not found in the string int tmp=-1; //--- loop. It will be executed at least once do { //--- assign the last known position of the substring pos=tmp; //--- continue searching (using the third parameter of the function) tmp=StringFind(Str,Find,tmp+1); } while(tmp!=-1); // If the substring is not found in the remaining part of the string, the loop // is terminated and the pos variable stores the last // known position //--- return the position return(pos); } //+------------------------------------------------------------------+ //| Deleting elements from the left end of the string according to the specified list| //+------------------------------------------------------------------+ string TrimL(string Str,string List="\t\n ;") { //--- variable for one character of the Str string string ch; int Len=StringLen(Str); int i=0; //--- loop iteration over all characters of the Str string for(;i=0;i--) { //--- the next character of the Str string ch=StringSubstr(Str,i,1); //--- if this character is not on the List list, the string should start from this position if(StringFind(List,ch,0)==-1) { break; // terminate the loop } } //--- get the substring and return it return(StringSubstr(Str,0,i+1)); } //+------------------------------------------------------------------+ //| Converting the string with the ";" separator to an array of the double type| //+------------------------------------------------------------------+ int ParamsToArray(string Str,double &Params[]) { //--- delete spaces at the ends StringTrimLeft(Str); StringTrimRight(Str); //--- if the string is empty if(StringLen(Str)==0) { ArrayFree(Params); // free the array return(0); // function operation complete } //--- auxiliary array string tmp[]; //--- split the string int size=StringSplit(Str,';',tmp); //--- delete spaces at the ends for each element of the array for(int i=0;i=0;i--) { if(StringLen(tmp[i])==0) { ArrayCopy(tmp,tmp,i,i+1); size--; // array size reduced } } //--- scale the array according to the new size ArrayResize(tmp,size); //--- replace commas with dots for(int i=0;i