You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/10/01 02:22:20 UTC
cvs commit: xml-xerces/c/src/xercesc/util XMLString.hpp XMLString.cpp
knoaman 2003/09/30 17:22:20
Modified: c/src/xercesc/util XMLString.hpp XMLString.cpp
Log:
Add a lastIndexOf method that takes the string length as one of the params.
Revision Changes Path
1.19 +24 -0 xml-xerces/c/src/xercesc/util/XMLString.hpp
Index: XMLString.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.hpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- XMLString.hpp 25 Aug 2003 20:39:47 -0000 1.18
+++ XMLString.hpp 1 Oct 2003 00:22:20 -0000 1.19
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.19 2003/10/01 00:22:20 knoaman
+ * Add a lastIndexOf method that takes the string length as one of the params.
+ *
* Revision 1.18 2003/08/25 20:39:47 neilg
* fix XMLString::findAny(...) docs so that they match what the method actually does (and has done since time immemorial)
*
@@ -723,6 +726,22 @@
/**
* Provides the index of the last occurance of a character within a string
+ *
+ * @param ch The character to search within the string
+ * @param toSearch The string to search
+ * @param toSearchLen The length of the string to search
+ * @return If found, returns the index of the character within the string,
+ * else returns -1.
+ */
+ static int lastIndexOf
+ (
+ const XMLCh ch
+ , const XMLCh* const toSearch
+ , const unsigned int toSearchLen
+ );
+
+ /**
+ * Provides the index of the last occurance of a character within a string
* starting backward from a given index
*
* @param toSearch The string to search
@@ -1626,6 +1645,11 @@
psz2++;
}
return false;
+}
+
+inline int XMLString::lastIndexOf(const XMLCh* const toSearch, const XMLCh ch)
+{
+ return XMLString::lastIndexOf(ch, toSearch, stringLen(toSearch));
}
XERCES_CPP_NAMESPACE_END
1.24 +5 -5 xml-xerces/c/src/xercesc/util/XMLString.cpp
Index: XMLString.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- XMLString.cpp 18 May 2003 14:02:05 -0000 1.23
+++ XMLString.cpp 1 Oct 2003 00:22:20 -0000 1.24
@@ -1209,11 +1209,11 @@
return -1;
}
-
-int XMLString::lastIndexOf(const XMLCh* const toSearch, const XMLCh ch)
+int XMLString::lastIndexOf(const XMLCh ch,
+ const XMLCh* const toSearch,
+ const unsigned int toSearchLen)
{
- const int len = stringLen(toSearch);
- for (int i = len-1; i >= 0; i--)
+ for (unsigned int i = toSearchLen-1; i >= 0; i--)
{
if (toSearch[i] == ch)
return i;
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org