src/cx/string.h

changeset 1043
256ea5a36b5a
parent 1040
1ecf4dbbc60c
equal deleted inserted replaced
1042:c17f11830a2d 1043:256ea5a36b5a
1113 CxStrtokCtx *ctx, 1113 CxStrtokCtx *ctx,
1114 const cxstring *delim, 1114 const cxstring *delim,
1115 size_t count 1115 size_t count
1116 ); 1116 );
1117 1117
1118 /* ------------------------------------------------------------------------- *
1119 * string to number conversion functions *
1120 * ------------------------------------------------------------------------- */
1121
1122
1123 int cx_strtos_lc(cxstring str, short *output, int base, const char *groupsep);
1124 int cx_strtoi_lc(cxstring str, int *output, int base, const char *groupsep);
1125 int cx_strtol_lc(cxstring str, long *output, int base, const char *groupsep);
1126 int cx_strtoll_lc(cxstring str, long int *output, int base, const char *groupsep);
1127 int cx_strtoi8_lc(cxstring str, int8_t *output, int base, const char *groupsep);
1128 int cx_strtoi16_lc(cxstring str, int16_t *output, int base, const char *groupsep);
1129 int cx_strtoi32_lc(cxstring str, int32_t *output, int base, const char *groupsep);
1130 int cx_strtoi64_lc(cxstring str, int64_t *output, int base, const char *groupsep);
1131 int cx_strtoz_lc(cxstring str, ssize_t *output, int base, const char *groupsep);
1132 int cx_strtous_lc(cxstring str, unsigned short *output, int base, const char *groupsep);
1133 int cx_strtou_lc(cxstring str, unsigned int *output, int base, const char *groupsep);
1134 int cx_strtoul_lc(cxstring str, unsigned long *output, int base, const char *groupsep);
1135 int cx_strtoull_lc(cxstring str, unsigned long int *output, int base, const char *groupsep);
1136 int cx_strtou8_lc(cxstring str, uint8_t *output, int base, const char *groupsep);
1137 int cx_strtou16_lc(cxstring str, uint16_t *output, int base, const char *groupsep);
1138 int cx_strtou32_lc(cxstring str, uint32_t *output, int base, const char *groupsep);
1139 int cx_strtou64_lc(cxstring str, uint64_t *output, int base, const char *groupsep);
1140 int cx_strtouz_lc(cxstring str, size_t *output, int base, const char *groupsep);
1141
1142 #define cx_strtos_lc(str, output, base, groupsep) cx_strtos_lc(cx_strcast(str), output, base, groupsep)
1143 #define cx_strtoi_lc(str, output, base, groupsep) cx_strtoi_lc(cx_strcast(str), output, base, groupsep)
1144 #define cx_strtol_lc(str, output, base, groupsep) cx_strtol_lc(cx_strcast(str), output, base, groupsep)
1145 #define cx_strtoll_lc(str, output, base, groupsep) cx_strtoll_lc(cx_strcast(str), output, base, groupsep)
1146 #define cx_strtoi8_lc(str, output, base, groupsep) cx_strtoi8_lc(cx_strcast(str), output, base, groupsep)
1147 #define cx_strtoi16_lc(str, output, base, groupsep) cx_strtoi16_lc(cx_strcast(str), output, base, groupsep)
1148 #define cx_strtoi32_lc(str, output, base, groupsep) cx_strtoi32_lc(cx_strcast(str), output, base, groupsep)
1149 #define cx_strtoi64_lc(str, output, base, groupsep) cx_strtoi64_lc(cx_strcast(str), output, base, groupsep)
1150 #define cx_strtoz_lc(str, output, base, groupsep) cx_strtoz_lc(cx_strcast(str), output, base, groupsep)
1151 #define cx_strtous_lc(str, output, base, groupsep) cx_strtous_lc(cx_strcast(str), output, base, groupsep)
1152 #define cx_strtou_lc(str, output, base, groupsep) cx_strtou_lc(cx_strcast(str), output, base, groupsep)
1153 #define cx_strtoul_lc(str, output, base, groupsep) cx_strtoul_lc(cx_strcast(str), output, base, groupsep)
1154 #define cx_strtoull_lc(str, output, base, groupsep) cx_strtoull_lc(cx_strcast(str), output, base, groupsep)
1155 #define cx_strtou8_lc(str, output, base, groupsep) cx_strtou8_lc(cx_strcast(str), output, base, groupsep)
1156 #define cx_strtou16_lc(str, output, base, groupsep) cx_strtou16_lc(cx_strcast(str), output, base, groupsep)
1157 #define cx_strtou32_lc(str, output, base, groupsep) cx_strtou32_lc(cx_strcast(str), output, base, groupsep)
1158 #define cx_strtou64_lc(str, output, base, groupsep) cx_strtou64_lc(cx_strcast(str), output, base, groupsep)
1159 #define cx_strtouz_lc(str, output, base, groupsep) cx_strtouz_lc(cx_strcast(str), output, base, groupsep)
1160
1161 #define cx_strtos(str, output, base) cx_strtos_lc(str, output, base, ",")
1162 #define cx_strtoi(str, output, base) cx_strtoi_lc(str, output, base, ",")
1163 #define cx_strtol(str, output, base) cx_strtol_lc(str, output, base, ",")
1164 #define cx_strtoll(str, output, base) cx_strtoll_lc(str, output, base, ",")
1165 #define cx_strtoi8(str, output, base) cx_strtoi8_lc(str, output, base, ",")
1166 #define cx_strtoi16(str, output, base) cx_strtoi16_lc(str, output, base, ",")
1167 #define cx_strtoi32(str, output, base) cx_strtoi32_lc(str, output, base, ",")
1168 #define cx_strtoi64(str, output, base) cx_strtoi64_lc(str, output, base, ",")
1169 #define cx_strtoz(str, output, base) cx_strtoz_lc(str, output, base, ",")
1170 #define cx_strtous(str, output, base) cx_strtous_lc(str, output, base, ",")
1171 #define cx_strtou(str, output, base) cx_strtou_lc(str, output, base, ",")
1172 #define cx_strtoul(str, output, base) cx_strtoul_lc(str, output, base, ",")
1173 #define cx_strtoull(str, output, base) cx_strtoull_lc(str, output, base, ",")
1174 #define cx_strtou8(str, output, base) cx_strtou8_lc(str, output, base, ",")
1175 #define cx_strtou16(str, output, base) cx_strtou16_lc(str, output, base, ",")
1176 #define cx_strtou32(str, output, base) cx_strtou32_lc(str, output, base, ",")
1177 #define cx_strtou64(str, output, base) cx_strtou64_lc(str, output, base, ",")
1178 #define cx_strtouz(str, output, base) cx_strtouz_lc(str, output, base, ",")
1179
1180 int cx_strtof_lc(cxstring str, float *output, char decsep, const char *groupsep);
1181 int cx_strtod_lc(cxstring str, double *output, char decsep, const char *groupsep);
1182
1183 #define cx_strtof_lc(str, output, decsep, groupsep) cx_strtof_lc(cx_strcast(str), output, decsep, groupsep)
1184 #define cx_strtod_lc(str, output, decsep, groupsep) cx_strtod_lc(cx_strcast(str), output, decsep, groupsep)
1185
1186 #define cx_strtof(str, output) cx_strtof_lc(str, output, '.', ",")
1187 #define cx_strtod(str, output) cx_strtod_lc(str, output, '.', ",")
1118 1188
1119 #ifdef __cplusplus 1189 #ifdef __cplusplus
1120 } // extern "C" 1190 } // extern "C"
1121 #endif 1191 #endif
1122 1192

mercurial