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

📄 stringex.h

📁 真正的传奇源代码
💻 H
字号:


#ifndef __ORZ_STRING__
#define __ORZ_STRING__


#include <string.h>
#include <ctype.h>


/*
	string support class (binary string)
*/
class bstr
{
public:
	char *ptr;
	int  size;

public:
	bstr();
	bstr( bstr &str );
	bstr( char *str );
	virtual ~bstr();

	bool alloc ( int len );
	bool expand( int len );
	bool assign( char *str, int len );
	bool assign( char *str );
	void cleanup();

	bool isassign();
	int  length();

	operator char * ()				{ return ptr; }
	operator const char * const ()	{ return (const char *) ptr; }

	char * operator =  ( char *str );
	char * operator =  ( bstr &str );
	char * operator =  ( int  num  );
	bool   operator == ( char *str );
	bool   operator != ( char *str );
	bstr & operator += ( char *str );
	bstr & operator += ( int  num  );
	friend bstr operator + ( bstr &str1, bstr &str2 );
	friend bstr operator + ( bstr &str1, char *str2 );
	friend bstr operator + ( char *str1, bstr &str2 );
};


/*
	C runtime function plus++
*/
char * _memstr( char *buf, int buf_len, char *str );	
char * _memistr( char *buf, int buf_len, char *str );


/*
	string manipulation
*/
bool _isspace( char c );
int  _ltrim( char *str );
int  _rtrim( char *str );
int  _trim( char *str );
int  _linecopy( char *str, char *buf );
int  _linecopy( bstr *str, char *buf );
bool _pickstring( char *str, char sep, int index, char *buf, int buf_len );


#endif

⌨️ 快捷键说明

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