B
bahadir.balban
Hi,
How do you check string intersection? There doesn't seem to be a
library function to do that, e.g:
+#include <linux/string.h>
+
+/* AND'ing two strings (checks intersection) */
+static int strand(char *s1, char *s2)
+{
+ int i, j;
+ int slen1 = strlen(s1);
+ int slen2 = strlen(s2);
+
+ for(i = 0; i < slen1; i++)
+ for(j = 0; j < slen2; j++)
+ if (s1 == s2[j])
+ return 1;
+ return 0;
+}
Thanks,
Bahadir
How do you check string intersection? There doesn't seem to be a
library function to do that, e.g:
+#include <linux/string.h>
+
+/* AND'ing two strings (checks intersection) */
+static int strand(char *s1, char *s2)
+{
+ int i, j;
+ int slen1 = strlen(s1);
+ int slen2 = strlen(s2);
+
+ for(i = 0; i < slen1; i++)
+ for(j = 0; j < slen2; j++)
+ if (s1 == s2[j])
+ return 1;
+ return 0;
+}
Thanks,
Bahadir