#1
The StringSplit function in MQL4 is used to split a string into separate elements based on a predefined delimiter character. The syntax of this function is as follows:

int StringSplit(
   string string_var, // The string to be split
   char separator, // The delimiter character
   string result_array[] // The array to store the split elements
);
Where:
  1. string_var: The string to be split
  2. separator: The delimiter character
  3. result_array[]: The array to store the split elements
This function returns the number of elements that are split from the original string. Here is an example of how to use the StringSplit function in MQL4 to split a string into separate elements:

string input_string = "bdo forex,StringSplit,Array Mt4";
string result_array[];
int count = StringSplit(input_string, ',', result_array);

for (int i = 0; i < count; i++)
{
Print(result_array[i]);
}
In the example above, we split the string "bdo forex,StringSplit,Array Mt4" into separate elements based on the delimiter character ',', resulting in 3 elements: 1. bdo forex, 2. StringSplit, and 3. Array Mt4. The result is stored in the array result_array[]. Finally, we iterate through the result_array[] to print the split elements.

image quote pre code
Xem hướng dẫn đăng nhập để đăng bình luận Tại Đây
Chia sẻ: