Apply fix on Parsers Conditions for && Cleaning on last index ...
This commit is contained in:
@@ -5695,7 +5695,8 @@ struct XMarketParser
|
||||
string _version; // Temp ...
|
||||
|
||||
//
|
||||
bool IsIngot(string market) {
|
||||
bool IsIngot(string market)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
@@ -5708,7 +5709,8 @@ struct XMarketParser
|
||||
}
|
||||
|
||||
//
|
||||
bool IsErrante(string market) {
|
||||
bool IsErrante(string market)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
@@ -5721,7 +5723,8 @@ struct XMarketParser
|
||||
}
|
||||
|
||||
//
|
||||
bool IsAMarkets(string market) {
|
||||
bool IsAMarkets(string market)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
@@ -5734,7 +5737,8 @@ struct XMarketParser
|
||||
}
|
||||
|
||||
//
|
||||
bool IsIFCMarkets(string market) {
|
||||
bool IsIFCMarkets(string market)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
@@ -5747,7 +5751,8 @@ struct XMarketParser
|
||||
}
|
||||
|
||||
//
|
||||
bool IsOtetMarkets(string market) {
|
||||
bool IsOtetMarkets(string market)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
@@ -5757,9 +5762,9 @@ struct XMarketParser
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
@@ -9876,6 +9881,80 @@ bool Contains(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int FindIndexes(
|
||||
string mQuery, // Search String
|
||||
string mContent, // Search Content
|
||||
int &result[], // Holding Results
|
||||
bool ignoreCase = false // Ignore Case
|
||||
)
|
||||
{
|
||||
//
|
||||
int mResult = 0;
|
||||
|
||||
//
|
||||
Clean(result);
|
||||
|
||||
//
|
||||
// Validate Inputs ...
|
||||
if (!IsValid(mQuery) ||
|
||||
!IsValid(mContent))
|
||||
{
|
||||
return mResult;
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Ignore Case if Provided ...
|
||||
if (ignoreCase)
|
||||
{
|
||||
//
|
||||
bool isConverted = StringToLower(mQuery);
|
||||
if (!isConverted)
|
||||
{
|
||||
return mResult;
|
||||
}
|
||||
|
||||
//
|
||||
isConverted = StringToLower(mContent);
|
||||
if (!isConverted)
|
||||
{
|
||||
return mResult;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Search First Index ...
|
||||
int lastPos = 0;
|
||||
int idx = StringFind(
|
||||
mContent,
|
||||
mQuery,
|
||||
lastPos //
|
||||
);
|
||||
while (idx >= 0)
|
||||
{
|
||||
//
|
||||
// Add Position to Result ...
|
||||
Add(
|
||||
idx,
|
||||
result //
|
||||
);
|
||||
|
||||
//
|
||||
lastPos = idx + StringLen(mQuery);
|
||||
idx = StringFind(
|
||||
mContent,
|
||||
mQuery,
|
||||
lastPos //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
mResult = ArraySize(result);
|
||||
|
||||
//
|
||||
return mResult;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert From String ...
|
||||
template <typename T>
|
||||
|
||||
@@ -756,6 +756,33 @@ struct XCHStartegyConditionsParser
|
||||
"||" + "\n" +
|
||||
"//";
|
||||
|
||||
//
|
||||
string query = "&&";
|
||||
int andIndexes[];
|
||||
int andIndexesCount = FindIndexes(
|
||||
query,
|
||||
result,
|
||||
andIndexes //
|
||||
);
|
||||
if (IsValidSize(andIndexesCount)) {
|
||||
//
|
||||
int lastAndIndex = andIndexes[ArraySize(andIndexes) - 1];
|
||||
|
||||
//
|
||||
string beforeStr = StringSubstr(
|
||||
result,
|
||||
0,
|
||||
lastAndIndex //
|
||||
);
|
||||
string afterStr = StringSubstr(
|
||||
result,
|
||||
lastAndIndex + StringLen(query)
|
||||
);
|
||||
|
||||
//
|
||||
result = beforeStr + afterStr;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user