/core/externals/google-toolbox-for-mac/Foundation/GTMNSString+Replace.h
C++ Header | 45 lines | 7 code | 6 blank | 32 comment | 0 complexity | 4ef30dde9fdf7e912de058e483f34889 MD5 | raw file
1// 2// GTMNSString+Replace.h 3// 4// Copyright 2006-2008 Google Inc. 5// 6// Licensed under the Apache License, Version 2.0 (the "License"); you may not 7// use this file except in compliance with the License. You may obtain a copy 8// of the License at 9// 10// http://www.apache.org/licenses/LICENSE-2.0 11// 12// Unless required by applicable law or agreed to in writing, software 13// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15// License for the specific language governing permissions and limitations under 16// the License. 17// 18 19#import <Foundation/Foundation.h> 20 21/// Give easy search-n-replace functionality to NSString. 22@interface NSString (GTMStringReplaceAdditions) 23 24#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 25// 10.5 has stringByReplacingOccurrencesOfString:withString:, use that directly. 26 27/// Returns a new autoreleased string by replacing all occurrences of 28// |oldString| with |newString| (case sensitive). If |oldString| is nil or 29// @"" nothing is done and |self| is returned. If |newString| is nil, it's 30// treated as if |newString| were the empty string, thus effectively 31// deleting all occurrences of |oldString| from |self|. 32// 33// Args: 34// target - the NSString to search for 35// replacement - the NSString to replace |oldString| with 36// 37// Returns: 38// A new autoreleased NSString 39// 40- (NSString *)gtm_stringByReplacingString:(NSString *)target 41 withString:(NSString *)replacement; 42 43#endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 44 45@end