diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2017-11-23 18:44:34 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-24 21:11:47 +0100 |
commit | 5e2a3eed69060d63070d72df60cd84247ca0bc9e (patch) | |
tree | b702110acd0ba35ed04df96352d2c22ffdff7a9b /sc | |
parent | 09455734727daa3774158795febd910b33b1d784 (diff) |
tdf#97198 Make Calc function FIND work with UniCode non-BMP characters.
Change-Id: I512199a5d29aa955b278f0666c7ce904e67d9767
Reviewed-on: https://gerrit.libreoffice.org/45171
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/functions/text/fods/find.fods | 148 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 11 |
2 files changed, 156 insertions, 3 deletions
diff --git a/sc/qa/unit/data/functions/text/fods/find.fods b/sc/qa/unit/data/functions/text/fods/find.fods index f5a1f2a2c06b..4f966cbe53a4 100644 --- a/sc/qa/unit/data/functions/text/fods/find.fods +++ b/sc/qa/unit/data/functions/text/fods/find.fods @@ -1254,7 +1254,151 @@ </table:table-cell> <table:table-cell table:number-columns-repeated="11"/> </table:table-row> - <table:table-row table:style-name="ro2" table:number-rows-repeated="61"> + <table:table-row table:style-name="ro2"> + <table:table-cell table:style-name="ce32" table:formula="of:=FIND([.I16];[.J16])" office:value-type="string" office:string-value="" calcext:value-type="error"> + <text:p>#VALUE!</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce24" table:formula="of:#VALUE!" office:value-type="string" office:string-value="" calcext:value-type="error"> + <text:p>#VALUE!</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce35" table:formula="of:=ISERROR([.A16])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A16])" office:value-type="string" office:string-value="=FIND(I16;J16)" calcext:value-type="string"> + <text:p>=FIND(I16;J16)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Excel 2016 has same result</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>B😂</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>ab😂de𝔖gh𝕬𝖈𝖍𝖙𝖚𝖓𝖌!</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:style-name="ce32" table:formula="of:=FIND([.I17];[.J16])" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce36" table:formula="of:=[.A17]=[.B17]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A17])" office:value-type="string" office:string-value="=FIND(I17;J16)" calcext:value-type="string"> + <text:p>=FIND(I17;J16)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Excel 2016 has same result</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>😂d</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32"/> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro6"> + <table:table-cell table:style-name="ce32" table:formula="of:=FIND([.I18];[.J18])" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce37" table:formula="of:=[.A18]=[.B18]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A18])" office:value-type="string" office:string-value="=FIND(I18;J18)" calcext:value-type="string"> + <text:p>=FIND(I18;J18)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Excel 2016 returns 4</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>𧀬</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>"<text:span text:style-name="T1">𧌒𧀬</text:span>"</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:style-name="ce32" table:formula="of:=FIND([.I19];[.J16])" office:value-type="float" office:value="8" calcext:value-type="float"> + <text:p>8</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32" office:value-type="float" office:value="8" calcext:value-type="float"> + <text:p>8</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce38" table:formula="of:=[.A19]=[.B19]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A19])" office:value-type="string" office:string-value="=FIND(I19;J16)" calcext:value-type="string"> + <text:p>=FIND(I19;J16)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Excel 2016 returns 10</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>h</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="6"/> + </table:table-row> + <table:table-row table:style-name="ro3"> + <table:table-cell table:style-name="ce32" table:formula="of:=FIND([.I20];[.J20])" office:value-type="float" office:value="4" calcext:value-type="float"> + <text:p>4</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32" office:value-type="float" office:value="4" calcext:value-type="float"> + <text:p>4</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce39" table:formula="of:=[.A20]=[.B20]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A20])" office:value-type="string" office:string-value="=FIND(I20;J20)" calcext:value-type="string"> + <text:p>=FIND(I20;J20)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Excel 2016 has same result</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>e</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce45" office:value-type="string" calcext:value-type="string"> + <text:p>"üë"</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:style-name="ce32" table:formula="of:=FIND([.I21];[.J21])" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce32" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce40" table:formula="of:=[.A21]=[.B21]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A21])" office:value-type="string" office:string-value="=FIND(I21;J21)" calcext:value-type="string"> + <text:p>=FIND(I21;J21)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>Excel 2016 returns 5</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"> + <text:p>𝖍𝖙</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce46" office:value-type="string" calcext:value-type="string"> + <text:p>𝕬𝖈𝖍𝖙𝖚𝖓𝖌!</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2" table:number-rows-repeated="55"> <table:table-cell table:style-name="ce23"/> <table:table-cell table:style-name="ce24"/> <table:table-cell table:style-name="ce27"/> @@ -1288,4 +1432,4 @@ </table:named-expressions> </office:spreadsheet> </office:body> -</office:document>
\ No newline at end of file +</office:document> diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2f2955b52927..f83040c79e39 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8526,7 +8526,16 @@ void ScInterpreter::ScFind() if (nPos == -1) PushNoValue(); else - PushDouble((double)(nPos + 1)); + { + sal_Int32 nIdx = 0; + nCnt = 0; + while ( nIdx <= nPos ) + { + sStr.iterateCodePoints( &nIdx ); + ++nCnt; + } + PushDouble( ( double )nCnt ); + } } } } |