ICU-5322 update sample code in doc comments.

X-SVN-Rev: 20216
This commit is contained in:
Eric Mader 2006-08-31 19:09:58 +00:00
parent 208671aabb
commit e2e03f351c
2 changed files with 13 additions and 8 deletions

View file

@ -114,13 +114,15 @@ U_NAMESPACE_BEGIN
* and examples of how to use instances of this class to implement text
* searching.
* <pre><code>
* 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());
* }

View file

@ -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);
* </code></pre>
* @stable ICU 2.4
*/