Difference between revisions of "String(API)"
(Created page with "General/'''String''' is API for string processing. == constant == #define STRING_MAX_LENGTH (8192) #define STRING_WORD_SEPARATOR " ,\t" #define STRING_COMMENT_LINE_ID '#...") |
(→API) |
||
Line 39: | Line 39: | ||
extern double stringGetRealDataFromField(char* s, long init, long end); | extern double stringGetRealDataFromField(char* s, long init, long end); | ||
extern long stringGetIntegerDataFromField(char* s, long init, long end); | extern long stringGetIntegerDataFromField(char* s, long init, long end); | ||
− | |||
− | |||
− | |||
Return length of string '''s'''. | Return length of string '''s'''. | ||
extern long stringLength(String s); | extern long stringLength(String s); | ||
+ | |||
+ | === Compare string === | ||
+ | Contrast '''s1''' and '''s2''' at '''n'''th(or '''s1''') words. If these are same, return 1. Otherwise, return 0. | ||
+ | extern long stringIsSame(String s1, String s2, long n); | ||
=== Copy string === | === Copy string === |
Latest revision as of 02:18, 9 October 2014
General/String is API for string processing.
Contents
constant
#define STRING_MAX_LENGTH (8192) #define STRING_WORD_SEPARATOR " ,\t" #define STRING_COMMENT_LINE_ID '#'
struct
typedef char* String; typedef unsigned long stringParaTypeInteger; typedef float stringParaTypeReal;
API
Initialize
extern void stringInit(String s, char* message);
Output string from a File
Return string read from fptIn.
(mode&0x01: 0: Output message, 1: not output message): Output message to fptOut.
if fptIn = stdin: as Standard Input, if fptout = stdout: as Standard Output.
extern String stringGetFromFile(char* s, char* message, FILE* fptIn, FILE* fptOut, long mode); extern char* __getStringData(char* s, char* message, FILE* fptIn, FILE* fptOut, long mode);
Return 1 string extracted from the above string. (separator: STRING_WORD_SEPARATOR)
extern String stringGetFromFileWithSkippingComment(char* s, char* message, FILE* fptIn, FILE* fptOut, long mode);
Extract string
Return nth string from string s by each separator of exception.
extern String stringGetNthWord(char* s, long nth, char* exception);
Return nth string as value from string s by each separator of exception.
extern double stringGetNthRealData(char* s, long nth, char* exception); extern long stringGetNthIntegerData(char* s, long nth, char* exception);
Return string in range of init-end in string s.
extern String stringGetWordFromField(char* s, long init, long end);
Return string as value in range of init-end in string s.
extern double stringGetRealDataFromField(char* s, long init, long end); extern long stringGetIntegerDataFromField(char* s, long init, long end);
Return length of string s.
extern long stringLength(String s);
Compare string
Contrast s1 and s2 at nth(or s1) words. If these are same, return 1. Otherwise, return 0.
extern long stringIsSame(String s1, String s2, long n);
Copy string
Copy string src to dst at nth words.(Return value: length of copied string)
extern long stringCopy(String dst, String src, long n);
Return string src allocating memory.
extern String stringDuplicate(String src);