Join an array of C strings using the specified separator (also a C string). * Returns the result as an sds string. */
| 1092 | /* Join an array of C strings using the specified separator (also a C string). |
| 1093 | * Returns the result as an sds string. */ |
| 1094 | sds sdsjoin(char **argv, int argc, char *sep) { |
| 1095 | sds join = sdsempty(); |
| 1096 | int j; |
| 1097 | |
| 1098 | for (j = 0; j < argc; j++) { |
| 1099 | join = sdscat(join, argv[j]); |
| 1100 | if (j != argc-1) join = sdscat(join,sep); |
| 1101 | } |
| 1102 | return join; |
| 1103 | } |
| 1104 | |
| 1105 | /* Like sdsjoin, but joins an array of SDS strings. */ |
| 1106 | sds sdsjoinsds(sds *argv, int argc, const char *sep, size_t seplen) { |