Commit fec05ac8 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

fixed: Bug 24656 - Функция MATCH некорректно находит текстовые значения с...

fixed: Bug 24656 - Функция MATCH некорректно находит текстовые значения с маской для аргумента lookup_value

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56580 954022d7-b5bf-4e40-9824-e11837661b57
parent 687c0c69
...@@ -503,14 +503,13 @@ cINDEX.prototype.Calculate = function ( arg ) { ...@@ -503,14 +503,13 @@ cINDEX.prototype.Calculate = function ( arg ) {
arg0 = arg0.getMatrix(); arg0 = arg0.getMatrix();
} }
else { else {
arg0 = [ arg0 = [[arg0.tryConvert()]];
[arg0.tryConvert()]
]
} }
res = arg0[arg1.getValue() - 1]; res = arg0[arg1.getValue() - 1];
if ( res ) if ( res ){
res = res[arg2.getValue() - 1]; res = res[arg2.getValue() - 1];
}
return this.value = res ? res : new cError( cErrorType.bad_reference ); return this.value = res ? res : new cError( cErrorType.bad_reference );
...@@ -846,6 +845,7 @@ cMATCH.prototype.Calculate = function ( arg ) { ...@@ -846,6 +845,7 @@ cMATCH.prototype.Calculate = function ( arg ) {
for ( var i = 0; i < arr.length; i++ ) { for ( var i = 0; i < arr.length; i++ ) {
if ( searchRegExp2( arr[i].toString(), a0Value ) ) { if ( searchRegExp2( arr[i].toString(), a0Value ) ) {
index = i; index = i;
break;
} }
} }
} }
...@@ -853,6 +853,7 @@ cMATCH.prototype.Calculate = function ( arg ) { ...@@ -853,6 +853,7 @@ cMATCH.prototype.Calculate = function ( arg ) {
for ( var i = 0; i < arr.length; i++ ) { for ( var i = 0; i < arr.length; i++ ) {
if ( arr[i] == a0Value ) { if ( arr[i] == a0Value ) {
index = i; index = i;
break;
} }
} }
} }
......
...@@ -3972,15 +3972,17 @@ function searchRegExp2( s, mask ) { ...@@ -3972,15 +3972,17 @@ function searchRegExp2( s, mask ) {
var nMaskLastIndex = 0; var nMaskLastIndex = 0;
var nSLength = s.length; var nSLength = s.length;
var nMaskLength = mask.length; var nMaskLength = mask.length;
var t = false;
for ( ; nSIndex < nSLength; nMaskIndex++, nSIndex++ ) { for ( ; nSIndex < nSLength; nMaskIndex++, nSIndex++ ) {
var cCurMask = mask[nMaskIndex]; var cCurMask = mask[nMaskIndex];
if ( '~' == cCurMask ) { if ( '~' == cCurMask ) {
nMaskIndex++; nMaskIndex++;
cCurMask = mask[nMaskIndex]; cCurMask = mask[nMaskIndex];
t = true;
} }
else if ( '*' == cCurMask ) else if ( '*' == cCurMask )
break; break;
if ( cCurMask != s[nSIndex] && '?' != cCurMask ) { if ( ( cCurMask != s[nSIndex] && '?' != cCurMask ) || ( cCurMask != s[nSIndex] && t) ) {
bRes = false; bRes = false;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment