summaryrefslogtreecommitdiff
path: root/src/common/strlib.h
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-02 15:55:15 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-02 15:55:15 +0000
commit12159b28c2e3d3280f5668cbcfd2d6ee25bb13ca (patch)
tree9a0f01f9ac61efc25915f4d74afa987f841fa709 /src/common/strlib.h
parent9d529a527d72b9ac4abd116ccfa7c2c199f958c5 (diff)
downloadhercules-12159b28c2e3d3280f5668cbcfd2d6ee25bb13ca.tar.gz
hercules-12159b28c2e3d3280f5668cbcfd2d6ee25bb13ca.tar.bz2
hercules-12159b28c2e3d3280f5668cbcfd2d6ee25bb13ca.tar.xz
hercules-12159b28c2e3d3280f5668cbcfd2d6ee25bb13ca.zip
* Added sv_split to strlib.c/h (similar to sv_parse).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12459 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/strlib.h')
-rw-r--r--src/common/strlib.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/common/strlib.h b/src/common/strlib.h
index 004fe6375..dae7f8b98 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -65,11 +65,20 @@ typedef enum e_svopt
#define SV_ESCAPE_C_SUPPORTED "abtnvfr\?\"'\\"
/// Parses a delim-separated string.
-/// Starts parsing at startoff and fills the pos array with the start and end
-/// positions in the string of the line and fields (that fit the array).
-/// Returns the number of fields or -1 if an error occurs.
+/// Starts parsing at startoff and fills the pos array with position pairs.
+/// out_pos[0] and out_pos[1] are the start and end of line.
+/// Other position pairs are the start and end of fields.
+/// Returns the number of fields found or -1 if an error occurs.
int sv_parse(const char* str, int len, int startoff, char delim, int* out_pos, int npos, enum e_svopt opt);
+/// Splits a delim-separated string.
+/// WARNING: this function modifies the input string
+/// Starts splitting at startoff and fills the out_fields array.
+/// out_fields[0] is the start of the next line.
+/// Other entries are the start of fields (nul-teminated).
+/// Returns the number of fields found or -1 if an error occurs.
+int sv_split(char* str, int len, int startoff, char delim, char** out_fields, int nfields, enum e_svopt opt);
+
/// Escapes src to out_dest according to the format of the C compiler.
/// Returns the length of the escaped string.
/// out_dest should be len*4+1 in size.