From e2e03f351cafcdb9ae5041ad27a0ae38855743e6 Mon Sep 17 00:00:00 2001 From: Eric Mader Date: Thu, 31 Aug 2006 19:09:58 +0000 Subject: [PATCH] ICU-5322 update sample code in doc comments. X-SVN-Rev: 20216 --- icu4c/source/i18n/unicode/stsearch.h | 10 ++++++---- icu4c/source/i18n/unicode/usearch.h | 11 +++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/icu4c/source/i18n/unicode/stsearch.h b/icu4c/source/i18n/unicode/stsearch.h index 3844315abf6..05fb7b65f7d 100644 --- a/icu4c/source/i18n/unicode/stsearch.h +++ b/icu4c/source/i18n/unicode/stsearch.h @@ -114,13 +114,15 @@ U_NAMESPACE_BEGIN * and examples of how to use instances of this class to implement text * searching. *

- * UnicodeString target("The quick brown fox jumped over the lazy fox");
+ * UnicodeString target("The quick brown fox jumps over the lazy dog.");
  * UnicodeString pattern("fox");
  *
- * SearchIterator *iter  = new StringSearch(pattern, target);
  * UErrorCode      error = U_ZERO_ERROR;
- * for (int pos = iter->first(error); pos != USEARCH_DONE; 
- *                               pos = iter->next(error)) {
+ * StringSearch iter(pattern, target, Locale::getUS(), NULL, status);
+ * for (int pos = iter.first(error);
+ *      pos != USEARCH_DONE; 
+ *      pos = iter.next(error))
+ * {
  *     printf("Found match at %d pos, length is %d\n", pos, 
  *                                             iter.getMatchLength());
  * }
diff --git a/icu4c/source/i18n/unicode/usearch.h b/icu4c/source/i18n/unicode/usearch.h
index 64b9e451dcd..a0c86cfb9ca 100644
--- a/icu4c/source/i18n/unicode/usearch.h
+++ b/icu4c/source/i18n/unicode/usearch.h
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 2001-2005 IBM and others. All rights reserved.
+*   Copyright (C) 2001-2006 IBM and others. All rights reserved.
 **********************************************************************
 *   Date        Name        Description
 *  06/28/2001   synwee      Creation.
@@ -115,15 +115,18 @@
  * u_uastrcpy(pattern, patstr);
  *
  * UStringSearch *search = usearch_open(pattern, -1, target, -1, "en_US", 
- *                                  &status);
+ *                                  NULL, &status);
  * if (U_SUCCESS(status)) {
  *     for (int pos = usearch_first(search, &status); 
- *                                      pos != USEARCH_DONE; 
- *                                      pos = usearch_next(search, &status)) {
+ *          pos != USEARCH_DONE; 
+ *          pos = usearch_next(search, &status))
+ *     {
  *         printf("Found match at %d pos, length is %d\n", pos, 
  *                                        usearch_getMatchLength(search));
  *     }
  * }
+ *
+ * usearch_close(search);
  * 
* @stable ICU 2.4 */