summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-01-13 10:02:50 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-01-13 10:02:50 -0500
commit24c29015ba668b044be7428f69058687a56d6a06 (patch)
treead413eedbc7c3eed30a276f339d9adf87ff01e49 /src
parent4eb2a196fa24d52462f3f325d73952fe2d1c12cd (diff)
More string processing
Diffstat (limited to 'src')
-rw-r--r--src/c/urweb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 7e62d571..015bb5f9 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -2194,6 +2194,17 @@ uw_Basis_int *uw_Basis_strindex(uw_context ctx, uw_Basis_string s, uw_Basis_char
}
}
+uw_Basis_int *uw_Basis_strsindex(uw_context ctx, const char *haystack, const char *needle) {
+ uw_Basis_string r = strstr(haystack, needle);
+ if (r == NULL)
+ return NULL;
+ else {
+ uw_Basis_int *nr = uw_malloc(ctx, sizeof(uw_Basis_int));
+ *nr = r - haystack;
+ return nr;
+ }
+}
+
uw_Basis_string uw_Basis_strcat(uw_context ctx, uw_Basis_string s1, uw_Basis_string s2) {
int len = uw_Basis_strlen(ctx, s1) + uw_Basis_strlen(ctx, s2) + 1;
char *s;