summaryrefslogtreecommitdiff
path: root/src/corefx/System.Globalization.Native/collation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corefx/System.Globalization.Native/collation.cpp')
-rw-r--r--src/corefx/System.Globalization.Native/collation.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corefx/System.Globalization.Native/collation.cpp b/src/corefx/System.Globalization.Native/collation.cpp
index f37211208e..a8c24e16ad 100644
--- a/src/corefx/System.Globalization.Native/collation.cpp
+++ b/src/corefx/System.Globalization.Native/collation.cpp
@@ -440,7 +440,8 @@ extern "C" int32_t GlobalizationNative_IndexOf(
int32_t cwTargetLength,
const UChar* lpSource,
int32_t cwSourceLength,
- int32_t options)
+ int32_t options,
+ int32_t* pMatchedLength)
{
static_assert(USEARCH_DONE == -1, "managed side requires -1 for not found");
@@ -455,6 +456,13 @@ extern "C" int32_t GlobalizationNative_IndexOf(
if (U_SUCCESS(err))
{
result = usearch_first(pSearch, &err);
+
+ // if the search was successful,
+ // we'll try to get the matched string length.
+ if(result != USEARCH_DONE && pMatchedLength != NULL)
+ {
+ *pMatchedLength = usearch_getMatchedLength(pSearch);
+ }
usearch_close(pSearch);
}
}