commit 06752c0ecc380d2d683abdb895ccd2275fac4ae9
parent 78a1079bda103c03f3c0eb1f37e59dc6563838c8
Author: William Casarin <jb55@jb55.com>
Date: Fri, 21 Jul 2023 14:58:45 -0700
add ndb_tag_matches_char function
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/nostrdb.h b/nostrdb.h
@@ -99,6 +99,17 @@ static inline const char * ndb_tag_str(struct ndb_note *note,
return ndb_note_str(note, &tag->strs[ind]);
}
+static inline int ndb_tag_matches_char(struct ndb_note *note,
+ struct ndb_tag *tag, int ind, char c)
+{
+ const char *str = ndb_tag_str(note, tag, ind);
+ if (str[0] == '\0')
+ return 0;
+ else if (str[0] == c)
+ return 1;
+ return 0;
+}
+
static inline const char * ndb_iter_tag_str(struct ndb_iterator *iter,
int ind)
{