viewing paste get_anchorid | C

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
char *anchorid;
 
void get_anchorid(char anchorname[])
{
    anchorid = anchorname;
    int i, j;
    for (i = 0, j = 0; anchorname[i] != 0; i++) {
        anchorname[i] = tolower(anchorname[i]);
 
        // Check space
        if (anchorname[i] == 32) {
            anchorname[i] = 45; // Change space to hyphen
        }
 
        // Check allow character. number, letter and hyphen(space)
        // All special character will be remove
        if ((anchorname[i] >= 97 && anchorname[i] <= 122) || (anchorname[i] >= 48 && anchorname[i] <= 57) || anchorname[i] == 45) {
            anchorname[j] = anchorname[i];
            j++;
        }
    }
    anchorname[j] = '\0';
}
Viewed 956 times, submitted by choidk.