summaryrefslogtreecommitdiff
path: root/sc/source/core/data/dputil.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/dputil.cxx')
-rw-r--r--sc/source/core/data/dputil.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sc/source/core/data/dputil.cxx b/sc/source/core/data/dputil.cxx
index 40cfafb0e5da..e21b2a86bbef 100644
--- a/sc/source/core/data/dputil.cxx
+++ b/sc/source/core/data/dputil.cxx
@@ -64,6 +64,27 @@ OUString ScDPUtil::getSourceDimensionName(const OUString& rName)
return comphelper::string::stripEnd(rName, '*');
}
+sal_uInt8 ScDPUtil::getDuplicateIndex(const OUString& rName)
+{
+ // Count all trailing '*'s.
+
+ sal_Int32 n = rName.getLength();
+ if (!n)
+ return 0;
+
+ sal_uInt8 nDupCount = 0;
+ const sal_Unicode* p = rName.getStr();
+ const sal_Unicode* pStart = p;
+ p += n-1; // Set it to the last char.
+ for (; p != pStart; --p, ++nDupCount)
+ {
+ if (*p != '*')
+ break;
+ }
+
+ return nDupCount;
+}
+
OUString ScDPUtil::createDuplicateDimensionName(const OUString& rOriginal, size_t nDupCount)
{
if (!nDupCount)