summaryrefslogtreecommitdiff
path: root/comphelper/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-02 10:55:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-05 09:18:19 +0000
commitbacfd2dc4cea1a5d87658ed8592116acd931e000 (patch)
treed22172a33fdd13a440b6882a28c23ea2d639bbad /comphelper/inc
parent6281eb0e0792da0194c07da18296e94dd944b8e5 (diff)
add a comphelper::string::getTokenCount
suitable for conversion from [Byte]String::GetTokenCount converted low-hanging variants to rtl::O[UString]::getToken loops added unit test
Diffstat (limited to 'comphelper/inc')
-rw-r--r--comphelper/inc/comphelper/string.hxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx
index 037c947d4953..1b8e18d9db74 100644
--- a/comphelper/inc/comphelper/string.hxx
+++ b/comphelper/inc/comphelper/string.hxx
@@ -280,8 +280,9 @@ COMPHELPER_DLLPUBLIC rtl::OString strip(const rtl::OString &rIn,
COMPHELPER_DLLPUBLIC rtl::OUString strip(const rtl::OUString &rIn,
sal_Unicode c);
-/** Returns a token in the OString
+/** Returns a token in an OString
+ @param rIn the input OString
@param token the number of the token to return
@param cTok the character which seperate the tokens.
@return the token if token is negative or doesn't exist an empty token
@@ -294,8 +295,9 @@ COMPHELPER_DLLPUBLIC inline rtl::OString getToken(const rtl::OString &rIn,
return rIn.getToken(nToken, cTok, nIndex);
}
-/** Returns a token in the OUString
+/** Returns a token in an OUString
+ @param rIn the input OUString
@param token the number of the token to return
@param cTok the character which seperate the tokens.
@return the token if token is negative or doesn't exist an empty token
@@ -308,6 +310,22 @@ COMPHELPER_DLLPUBLIC inline rtl::OUString getToken(const rtl::OUString &rIn,
return rIn.getToken(nToken, cTok, nIndex);
}
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OString
+ @param cTok the character which seperate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const rtl::OString &rIn, sal_Char cTok);
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OUString
+ @param cTok the character which seperate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const rtl::OUString &rIn, sal_Unicode cTok);
+
/**
Match against a substring appearing in another string.