- neural network or machine learning for EA
- File Append
- how to decrypt the "AES128" data in mql4 called by JAVA
StringConcatenate() |
StringFormat() |
StringAdd() |
Just type them into the editor place the cursor above one and press F1 to get the details to use them.
Is there something like a stringbuilder (Java) or stringbuffer (C#) in MQL4 that facilitates fast string append?
Not as such, no. There's nothing which defers the creation of a large contiguous memory block into a single final operation, instead of building the string incrementally - no string-builder class, and no alternative such as creating an array of strings and then doing a join operation on it.
However, StringAdd() is vastly faster than StringConcatenate(), and has performance broadly in line with what you'd expect from a string-builder.
However, StringAdd() is vastly faster than StringConcatenate(), and has performance broadly in line with what you'd expect from a string-builder.
... A wrapper such as the following around StringAdd() does improve the performance on large strings compared to a simple repeated concatenation:
class StringBuilder { private: string large; string small; void Collapse() { StringAdd(large, small); small = ""; } public: int _STRING_CONCAT_THRESHOLD; StringBuilder() { large = ""; small = ""; _STRING_CONCAT_THRESHOLD = 100000; } void Append(string X) { if (StringLen(X) > _STRING_CONCAT_THRESHOLD) { Collapse(); StringAdd(large, X); } else { StringAdd(small, X); if (StringLen(small) > _STRING_CONCAT_THRESHOLD) { Collapse(); } } } string ToString() { Collapse(); return large; } };

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use