Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Side by Side Diff: sdk/lib/core/string.dart

Issue 11312144: Allow function as replacement argument to String.replaceAll. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/core/regexp.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * The String class represents character strings. Strings are 6 * The String class represents character strings. Strings are
7 * immutable. A string is represented by a list of 32-bit Unicode 7 * immutable. A string is represented by a list of 32-bit Unicode
8 * scalar character codes accessible through the [charCodeAt] or the 8 * scalar character codes accessible through the [charCodeAt] or the
9 * [charCodes] method. 9 * [charCodes] method.
10 */ 10 */
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool contains(Pattern other, [int startIndex]); 92 bool contains(Pattern other, [int startIndex]);
93 93
94 /** 94 /**
95 * Returns a new string where the first occurence of [from] in this string 95 * Returns a new string where the first occurence of [from] in this string
96 * is replaced with [to]. 96 * is replaced with [to].
97 */ 97 */
98 String replaceFirst(Pattern from, String to); 98 String replaceFirst(Pattern from, String to);
99 99
100 /** 100 /**
101 * Returns a new string where all occurences of [from] in this string 101 * Returns a new string where all occurences of [from] in this string
102 * are replaced with [to]. 102 * are replaced with a [String] depending on [replace].
103 *
104 * If [replace] is a [Function], it's called with the [Match] generated
105 * by the pattern, and its result is used as replacement.
106 * Otherwise, [replace] must be a [String], which is directly used as
107 * the replacement.
103 */ 108 */
104 String replaceAll(Pattern from, String to); 109 String replaceAll(Pattern from, var replace);
105 110
106 /** 111 /**
107 * Splits the string around matches of [pattern]. Returns 112 * Splits the string around matches of [pattern]. Returns
108 * a list of substrings. 113 * a list of substrings.
109 */ 114 */
110 List<String> split(Pattern pattern); 115 List<String> split(Pattern pattern);
111 116
112 /** 117 /**
113 * Returns a list of the characters of this string. 118 * Returns a list of the characters of this string.
114 */ 119 */
(...skipping 28 matching lines...) Expand all
143 * Joins all the given strings to create a new string. 148 * Joins all the given strings to create a new string.
144 */ 149 */
145 external static String join(List<String> strings, String separator); 150 external static String join(List<String> strings, String separator);
146 151
147 /** 152 /**
148 * Concatenates all the given strings to create a new string. 153 * Concatenates all the given strings to create a new string.
149 */ 154 */
150 external static String concatAll(List<String> strings); 155 external static String concatAll(List<String> strings);
151 156
152 } 157 }
OLDNEW
« no previous file with comments | « sdk/lib/core/regexp.dart ('k') | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698