/core/externals/update-engine/externals/google-toolbox-for-mac/Foundation/GTMNSString+Replace.h

http://macfuse.googlecode.com/ · 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. #import <Foundation/Foundation.h>
  19. /// Give easy search-n-replace functionality to NSString.
  20. @interface NSString (GTMStringReplaceAdditions)
  21. #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
  22. // 10.5 has stringByReplacingOccurrencesOfString:withString:, use that directly.
  23. /// Returns a new autoreleased string by replacing all occurrences of
  24. // |oldString| with |newString| (case sensitive). If |oldString| is nil or
  25. // @"" nothing is done and |self| is returned. If |newString| is nil, it's
  26. // treated as if |newString| were the empty string, thus effectively
  27. // deleting all occurrences of |oldString| from |self|.
  28. //
  29. // Args:
  30. // target - the NSString to search for
  31. // replacement - the NSString to replace |oldString| with
  32. //
  33. // Returns:
  34. // A new autoreleased NSString
  35. //
  36. - (NSString *)gtm_stringByReplacingString:(NSString *)target
  37. withString:(NSString *)replacement;
  38. #endif // MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
  39. @end