Download mychar ¿¡¼ ¸ðµç ÇÁ·Î±×·¥µéÀ» ÇϳªÀÇ tar.gz ÈÀÏ·Î ´Ù¿î·Îµå¹ÞÀ» ¼ö ÀÖ´Ù. ÀÌ ÈÀÏÀ» ¹ÞÀ¸·Á¸é À¥ºê¶ó¿ìÀú¿¡¼ ÀÌ ÈÀÏÀ» 'Text' ŸÀÔÀ¸·Î ÀúÀåÇÑ´Ù.
//***************************************************************** //ÀúÀÛ±ÇÀº GNU/GPL ¿¡ ÀÖÁö¸¸ ÀúÀÚÀÇ À̸§°ú À̸ÞÀÏÀº ¸ðµç º¹»çº»¿¡ //Æ÷ÇÔ½ÃÄÑ¾ß ÇÑ´Ù. //ÀúÀÚ: Al Dev À̸ÞÀÏ: alavoor@yahoo.com //***************************************************************** //¸Þ¸ð¸®À¯ÃâÀ» ¹æÁöÇϱâÀ§Çؼ´Â - a char class to manage character //variables //char[] ȤÀº char *´ë½Å mychar ³ª string class ¸¦ »ç¿ëÇÏ´Â °ÍÀÌ ÁÁ´Ù. #ifndef __MYCHAR_H_ #define __MYCHAR_H_ //#include <iostream> // iostreamÀº ÇÁ·Î±×·¥ÀÌ Ä¿Áö´Ï±î »ç¿ëÇÏÁö ¾Ê´Â´Ù. //#include <stdlib.h> //free() ¿Ímalloc() ¸¦ ¾²±âÀ§ÇØ #include <string.h> // for strcpy() #include <ctype.h> // for isspace() #include <stdio.h> // for sprintf() #include <list.h> // for sprintf() #include <math.h> // for modf(), rint() #include "my_malloc.h" #include "debug.h" // debug_(name, value) debug2_(name, value, LOG_YES) const short INITIAL_SIZE = 50; const short NUMBER_LENGTH = 70; // ÃÖ¼ÒÇÑÀÇ ÇÔ¼ö¿Í º¯¼ö¸¦ °¡Áø ÀÛÀº Ŭ·¡½º (class) // This class to be kept small... ÀÌ Å¬·¡½º´Â °è¼Ó ÀÛ°Ô À¯ÁöµÉ°ÍÀÌ´Ù. class mychar { public: mychar(); mychar(char bb[]); // needed by operator+ mychar(int bb); // needed by operator+ mychar(unsigned long bb); // needed by operator+ mychar(float bb); // needed by operator+ mychar(double bb); // needed by operator+ mychar(const mychar & rhs); // Copy Constructor needed by operator+ ~mychar(); char *val; unsigned long length() { return strlen(val); } void ltrim(); void rtrim(); void trim(); void chop(); void to_upper(); void to_lower(); void roundf(float input_val, short precision); void decompose_float(long *integral, long *fraction); void roundd(double input_val, short precision); void decompose_double(long *integral, long *fraction); long pos(char substr[], unsigned long start); void explode(char *seperator); void implode(char *glue); void join(char *glue); void repeat(char *input, unsigned int multiplier); void reverse(); void replace(char *needle, char *str); void str_tr(char *from, char *to); void center(int length, char padchar = ' '); void space(int number = 0, char padchar = ' '); void xrange(char start, char end); void compress(char *list); void delstr(int start, int length); void insert(char *newstr, int start = 0, int length = 0, char padchar = ' '); void left(int length = 0, char padchar = ' '); void right(int length = 0, char padchar = ' '); void overlay(char *newstr, int start = 0, int length = 0, char padchar = ' '); mychar substr(int start, int length = 0); mychar at(char *regx); // matches first match of regx mychar before(char *regx); // returns string before regx mychar after(char *regx); // returns string after regx bool isnull(); void clear(); // All Operators ... mychar operator+ (const mychar & rhs); friend mychar operator+ (const mychar & lhs, const mychar & rhs); mychar& operator+= (const mychar & rhs); // using reference will be faster mychar& operator= (const mychar & rhs); // using reference will be faster bool operator== (const mychar & rhs); // using reference will be faster bool operator== (const char *rhs); bool operator!= (const mychar & rhs); bool operator!= (const char *rhs); static list<mychar> explodeH; // list head private: //static mychar *global_mychar; // for use in add operator //inline void free_glob(mychar **aa); void str_cpy(char bb[]); void str_cpy(int bb); // itoa void str_cpy(unsigned long bb); void str_cpy(float bb); // itof void str_cat(char bb[]); void str_cat(int bb); void str_cat(unsigned long bb); void str_cat(float bb); bool equalto(const mychar & rhs, bool type = false); bool equalto(const char *rhs, bool type = false); }; // Global variables are defined in mychar.cpp #endif // __MYCHAR_H_