Changeset 73 for trunk/src/helpers/stringh.c
- Timestamp:
- May 23, 2001, 6:59:40 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/stringh.c
r69 r73 1152 1152 * 1153 1153 * <B>Example:</B> 1154 + strhFindAttribValue("<PAGE BLAH= "data">, "BLAH")1154 + strhFindAttribValue("<PAGE BLAH=\"data\">", "BLAH") 1155 1155 + 1156 1156 + returns ....................... ^ this address. … … 1158 1158 *@@added V0.9.0 [umoeller] 1159 1159 *@@changed V0.9.3 (2000-05-19) [umoeller]: some speed optimizations 1160 *@@changed V0.9.12 (2001-05-22) [umoeller]: fixed space bug, thanks Yuri Dario 1160 1161 */ 1161 1162 1162 1163 PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib) 1164 { 1165 PSZ prc = 0; 1166 PSZ pszSearchIn2, p; 1167 ULONG cbAttrib = strlen(pszAttrib), 1168 ulLength = strlen(pszSearchIn); 1169 1170 // use alloca(), so memory is freed on function exit 1171 pszSearchIn2 = (PSZ)alloca(ulLength + 1); 1172 memcpy(pszSearchIn2, pszSearchIn, ulLength + 1); 1173 1174 // 1) find token, (space char, \n, \r, \t) 1175 p = strtok(pszSearchIn2, " \n\r\t"); 1176 while (p) 1177 { 1178 CHAR c2; 1179 PSZ pOrig; 1180 1181 // check tag name 1182 if (!strnicmp(p, pszAttrib, cbAttrib)) 1183 { 1184 // position in original string 1185 pOrig = (PSZ)pszSearchIn + (p - pszSearchIn2); 1186 1187 // yes: 1188 prc = pOrig + cbAttrib; 1189 c2 = *prc; 1190 while ( ( (c2 == ' ') 1191 || (c2 == '=') 1192 || (c2 == '\n') 1193 || (c2 == '\r') 1194 ) 1195 && (c2 != 0) 1196 ) 1197 c2 = *++prc; 1198 1199 break; 1200 } 1201 1202 p = strtok(NULL, " \n\r\t"); 1203 } 1204 1205 return (prc); 1206 } 1207 1208 /* PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib) 1163 1209 { 1164 1210 PSZ prc = 0; … … 1211 1257 } 1212 1258 return (prc); 1213 } 1259 } */ 1214 1260 1215 1261 /*
Note:
See TracChangeset
for help on using the changeset viewer.