Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

count number of items using delimiter

unsigned int num_items(const char* str, char delimiter){
    unsigned int words=0;
    if(!str) return 0;
    while(*str){
        words += (*str++) == delimiter;
    }
    return words+1;
}
 
PREVIOUS NEXT
Tagged: #count #number #items #delimiter
ADD COMMENT
Topic
Name
8+3 =