⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 string.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 4 页
字号:
			object is less than lpsz, or > 0 if this string object
			is greater than lpsz.
		SeeAlso:
			string::CompareNoCase.
	*/
	int		Compare( LPCSTR lpsz );	
	
	/**
		Remarks:
			This member function performs a case-insensitive comparison 
			of this string object with another string.
		Example:
			string str1("abc");
			string str2("ABD");
			ASSERT(str1.CompareNoCase("abb")==1);
			ASSERT(str1.CompareNoCase(str2)==-1);
			ASSERT(str1.CompareNoCase("ABC")==0);
		Parameters:
			lpsz = The other string used for comparison.
		Return:
			Zero if the strings are identical, < 0 if this string 
			object is less than lpsz, or > 0 if this string object
			is greater than lpsz.
		SeeAlso:
			string::Compare
	*/
	int		CompareNoCase( LPCSTR lpsz );
	
	/**
		Remarks:
			This overloaded member function searches this string for the
			first match of a single character.
		Example:
			string str1("abcdef");
			ASSERT(str1.Find('c')==2);
		Parameters:
			ch = A single character to search for.
		Return:
			Returns the zero-based index of the first character in this string
			object that matches the character.  It will return -1 if the character
			is not found.
		SeeAlso:
			string::ReverseFind, string::FindOneOf
	*/
	int		Find( char ch );
	
	/**
		Remarks:
			This overloaded member function searches this string for the
			first match of a substring.
		Example:
			string str2("abcdef");
			ASSERT(str2.Find("de") == 3);
		Parameters:
			lpszsub = A substring to search for.
		Return:
			Returns the zero-based index of the first character in this string
			object that matches the character.  It will return -1 if the character
			is not found.
		SeeAlso:
			string::ReverseFind, string::FindOneOf
	*/
	int		Find( LPCSTR lpszSub );
	
	/**
		Remarks:
			This overloaded member function searches this string for the
			match of a character.
		Example:
			string str3("Hello World");
			ASSERT(str3.Find('o',5)==7);
		Parameters:
			ch = A single character to search for.
			nStart = The index of the character in the string to begin the
			search with.  If nStart equals 0, search starts from the
			beginning.  The character at nStart is excluded from the search
			 if nStart is not equal to 0.
		Return:
			Returns the zero-based index of the first character in this string
			object that matches the character.  It will return -1 if the character
			is not found.
		SeeAlso:
			string::ReverseFind, string::FindOneOf
	*/
	int		Find( char ch, int nStart );
	
	/**
		Remarks:
			This overloaded member function searches this string for the
			match of a substring.
		Example:
			string str4("Happy Birthday");
			ASSERT(str4.Find("day",4)==11);
		Parameters:
			pstr = A pointer to a string to search for.
			nStart = The index of the character in the string to begin the
			search with.  If nStart equals 0, search starts from the
			beginning.  The character at nStart is excluded from the search
			 if nStart is not equal to 0.
		Return:
			Returns the zero-based index of the first character in this string
			object that matches the requested substring.  It will return -1 if 
			the character is not found.
		SeeAlso:
			string::ReverseFind, string::FindOneOf
	*/
	int		Find( LPCSTR lpszSub, int nStart );
		
	/**
		Remarks:
			This member function searches this string object for the 
			last match of a character.
		Example:
			string str1("abcabc");
			ASSERT(str1.ReverseFind('b') == 4 );
		Parameters:
			ch = The character to search for.
		Return:
			Returns the index of the last character in this string 
			object that matches the requested character; -1 if the 
			character is not found.
		SeeAlso:
			string::Find, string::FindOneOf
	*/
	int		ReverseFind( char ch );	

	/**
		Remarks:
			This overloaded member function inserts a single character at the 
			given index within the string.  The nIndex parameter 
			identifies the first character that will be moved to make 
			room for the character. If nIndex is zero, the insertion 
			will occur before the entire string. If nIndex is higher 
			than the length of the string, the function will concatenate 
			the string and the character.
		Example:
			string str1("love summer");
			str1.Insert(0,'I');
			ASSERT(str1.Compare("Ilove summer")==0);
		Parameters:
			nIndex = The index of the character before which the insertion 
			will take place.
			ch = The character to be inserted.
		Return:
			The length of the changed string.
		SeeAlso:
			string::Delete
	*/
	int		Insert( int nIndex, char ch );
	
	/**
		Remarks:
			This overloaded member function inserts a substring at the 
			given index within the string.  The nIndex parameter 
			identifies the first character that will be moved to make 
			room for the substring. If nIndex is zero, the insertion 
			will occur before the entire string. If nIndex is higher 
			than the length of the string, the function will concatenate 
			the string and the substring.
		Example:
			string str1("I summer");
			str1.Insert(2,"love");
			ASSERT(str1.Compare("I lovesummer")==0);
		Parameters:
			nIndex = The index of the character before which the insertion 
			will take place.
			pstr = A pointer to the substring to be inserted.
		Return:
			The length of the changed string.
		SeeAlso:
			string::Delete
	*/
	int		Insert( int nIndex, LPCTSTR pstr );
	
	/**
		Remarks:
			This member function deletes a character or characters 
			from a string starting with the character at nIndex. If 
			nCount is longer than the string, the remainder of the 
			string will be removed.
		Example:
			string str("Summer is best");
			str.Delete(6,3);
			ASSERT(0 == str.Compare("Summer best"));
			ASSERT(str.GetLength()==11);
		Parameters:
			nIndex = The index of the first character to delete.
			nCount = The number of characters to be removed.
		Return:
			The length of the changed string.
		SeeAlso:
			string::Insert
	*/
	int     Delete( int nIndex, int nCount = 1 );

	/**
		Remarks:
			Converts this string object to a lowercase string.
		Example:
			string str("ABCD");
			str.MakeLower();
			ASSERT(str.Compare("abcd")==0);
		Parameters:
			None.
		Return:
			None.
		SeeAlso:
			string::MakeUpper
	*/
	void	MakeLower( );
	
	/**
		Remarks:
			Converts this string object to an uppercase string.
		Example:
			string str("abcd");
			str.MakeUpper();
			ASSERT(str.Compare("ABCD")==0);
		Parameters:
			None.
		Return:
			None.
		SeeAlso:
			string::MakeLower
	*/
	void	MakeUpper( );
		
	/**
		Remarks:
			Extracts a substring of length nCount characters from this 
			string object, starting at position nFirst (zero-based). 
		Example:
			string str1("I love summer!");
			string str2=str1.Mid(2,4);
			ASSERT(str2.Compare("love")==0);
		Parameters:
			nFirst = The zero-based index of the first character in this 
			string object that is to be included in the extracted 
			substring.
			nCount = The number of characters to extract from this 
			string object. If this parameter is not supplied, then the 
			remainder of the string is extracted.
		Return:
			Returns a copy of the extracted substring. 
		SeeAlso:
			string::Left, string::Right
	*/
	string  Mid( int nFirst, int nCount );
	string  Mid( int nFirst );

	/**
		Remarks:
			This member function returns a single character specified 
			by an index number. 
		Example:
			string str( "abcdef" );
			ASSERT( str.GetAt(2) == 'c' );
		Parameters:
			nIndex = Zero-based index of the character in the string 
			object. The nIndex parameter must be greater than or equal 
			to 0 and less than the value returned by GetLength.
		Return:
			A char containing the character at the specified position in the string.
		SeeAlso:
			string::SetAt, string::GetLength
	*/ 
	char	GetAt( int nIndex ); 

	/**
		Remarks:
			This member function overwrites a single character specified 
			by an index number. SetAt will not enlarge the string if the 
			index exceeds the bounds of the existing string.
		Example:
			string str( "abcdef" );
			str.SetAt(2,'z');
			ASSERT(str.Compare("abzdef")==0);
		Parameters:
			nIndex = Zero-based index of the character in the string object.
			The nIndex parameter must be greater than or equal to 0 and
			less than the value returned by GetLength. 
			ch = The character to insert.
		Return:
			None.
		SeeAlso:
			string::GetAt
	*/
	void	SetAt( int nIndex, char ch );
		
	/**
		Remarks:
			This member function returns the nth token where a token is 
			separated by the delimiter specified by chDelimiter.  Default
			is 0 (null constant) so chDelimiter does not have to be specified 
			when any white space (space, tab, newline, etc.) is to be used 
			as the delimiter.
		Example:
			string str1("apples peaches pumpkins");
			string str3("apples,peaches,pumpkins");
			string str2=str1.GetToken(1);
			string str4=str3.GetToken(1,',');
			ASSERT(str2.Compare("peaches")==0);
			ASSERT(str4.Compare("peaches")==0);
		Parameters:
			nToken = An integer representing the token to get.
			chDelimiter = A character representing the delimiter.
		Return:
			The extracted string token.
		SeeAlso:
			string::GetNumTokens, string::GetTokens	
	
	*/
	string	GetToken( int nToken, char chDelimiter = 0 );
	
	/**
		Remarks:
			This member function returns the number of tokens in this string
			where a token is separated by the delimiter specified by chDelimiter. 
			Default is 0 (null constant) so chDelimiter does not have to be 
			specified when any white space (space, tab, newline, etc.) is to be 
			used as the delimiter.
		Example:
			string str1("apples peaches pumpkins");
			string str2("apples,peaches,pumpkins");
			ASSERT(str1.GetNumTokens()==3);
			ASSERT(str2.GetNumTokens(',')==3);
		Parameters:
			chDelimiter = A character representing the delimiter.
		Return:
			The number of tokens in this string.
		SeeAlso:
			string::GetToken, string::GetTokens	

	*/
	int		GetNumTokens( char chDelimiter = 0 );

	/**
		Remarks:
			Create a StringArray from this string
		Example:
			StringArray strTokens;
			strTokens.SetSize(3);
			string str = "1@2@3#4#5$6$";
			ASSERT( 3 == str.GetTokens( strTokens, '@') );
			ASSERT( 0 == strTokens[0].Compare("1") );
			ASSERT( 0 == strTokens[1].Compare("2") );
			ASSERT( 0 == strTokens[2].Compare("3#4#5$6$") );
		Parameters:
			saTokens = string array which store the results found.	
			chDelimiter = A character representing the delimiter.
		Return:
			Number of tokens (strings) found
		SeeAlso:
			string::GetNumTokens, string::GetToken	
	*/
	int		GetTokens( StringArray& saTokens, char chDelimiter = 0 );

	/**#
		Remarks:
			Copy a StringArray into this string and separate them with specified delimiter
		Example:
			StringArray saColors = {"red", "green", "blue"};
			for( int n = 0; n < saColors.GetSize(); n++ )
				printf("Array element %d = %s\n", n, saColors[n]);
			string strColors;
			strColors.SetTokens(saColors, '|');
			printf("Delimited string = %s\n", strColors);
		Parameters:
			saTokens = string array containing the tokens
			chDelimiter = character to use as the delimiter
		Return:
			Number of tokens in this string, -1 for error
		SeeAlso:
			string::GetNumTokens, string::GetTokens
	*/
	int SetTokens(StringArray& saTokens, char chDelimiter = '\t');

	/**#
		Remarks:
			Find a token in this string
		Example:
			StringArray saColors = {"red", "green", "blue"};
			for( int n = 0; n < saColors.GetSize(); n++ )
				printf("Array element %d = %s\n", n, saColors[n]);
			string strColors;
			strColors.SetTokens(saColors, '|');
			printf("Delimited string = %s\n", strColors);
		
			saColors.Add("yellow"); // add string not in delimited string
			
			string strToken;
			int nToken;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -