1  /** Declaration of extension methods for base additions
       2  
       3     Copyright (C) 2003-2010 Free Software Foundation, Inc.
       4  
       5     Written by:  Richard Frith-Macdonald <rfm@gnu.org>
       6     and:         Adam Fedor <fedor@gnu.org>
       7  
       8     This file is part of the GNUstep Base Library.
       9  
      10     This library is free software; you can redistribute it and/or
      11     modify it under the terms of the GNU Lesser General Public
      12     License as published by the Free Software Foundation; either
      13     version 2 of the License, or (at your option) any later version.
      14     
      15     This library is distributed in the hope that it will be useful,
      16     but WITHOUT ANY WARRANTY; without even the implied warranty of
      17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      18     Library General Public License for more details.
      19  
      20     You should have received a copy of the GNU Lesser General Public
      21     License along with this library; if not, write to the Free
      22     Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
      23     Boston, MA 02111 USA.
      24  
      25  */
      26  
      27  #ifndef	INCLUDED_NSString_GNUstepBase_h
      28  #define	INCLUDED_NSString_GNUstepBase_h
      29  
      30  #import "GSVersionMacros.h"
      31  #import "../Foundation/NSString.h"
      32  
      33  #if	defined(__cplusplus)
      34  extern "C" {
      35  #endif
      36  
      37  #if	OS_API_VERSION(GS_API_NONE,GS_API_LATEST)
      38  
      39  /**
      40   * Provides some additional (non-standard) utility methods.
      41   */
      42  @interface NSString (GNUstepBase)
      43  
      44  /**
      45   * Alternate way to invoke <code>stringWithFormat</code> if you have or wish
      46   * to build an explicit <code>va_list</code> structure.
      47   */
      48  + (id) stringWithFormat: (NSString*)format
      49  	      arguments: (va_list)argList NS_FORMAT_FUNCTION(1,0);
      50  
      51  /**
      52   * Returns a string formed by removing the prefix string from the
      53   * receiver.  Raises an exception if the prefix is not present.
      54   */
      55  - (NSString*) stringByDeletingPrefix: (NSString*)prefix;
      56  
      57  /**
      58   * Returns a string formed by removing the suffix string from the
      59   * receiver.  Raises an exception if the suffix is not present.
      60   */
      61  - (NSString*) stringByDeletingSuffix: (NSString*)suffix;
      62  
      63  /**
      64   * Returns a string formed by removing leading white space from the
      65   * receiver.
      66   */
      67  - (NSString*) stringByTrimmingLeadSpaces;
      68  
      69  /**
      70   * Returns a string formed by removing trailing white space from the
      71   * receiver.
      72   */
      73  - (NSString*) stringByTrimmingTailSpaces;
      74  
      75  /**
      76   * Returns a string formed by removing both leading and trailing
      77   * white space from the receiver.
      78   */
      79  - (NSString*) stringByTrimmingSpaces;
      80  
      81  /**
      82   * Returns a string in which any (and all) occurrences of
      83   * replace in the receiver have been replaced with by.
      84   * Returns the receiver if replace
      85   * does not occur within the receiver.  NB. an empty string is
      86   * not considered to exist within the receiver.
      87   */
      88  - (NSString*) stringByReplacingString: (NSString*)replace
      89  			   withString: (NSString*)by;
      90  
      91  /**
      92   * An obsolete name for -substringWithRange: ... deprecated.
      93   */
      94  - (NSString*) substringFromRange: (NSRange)aRange;
      95  
      96  @end
      97  
      98  #endif	/* OS_API_VERSION */
      99  
     100  #if	defined(__cplusplus)
     101  }
     102  #endif
     103  
     104  #endif	/* INCLUDED_NSString_GNUstepBase_h */
     105