Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, April 20, 2024

File: [Platon] / tucniak / util / str.c (download)

Revision 1.1.1.1 (vendor branch), Fri Nov 11 16:08:27 2005 UTC (18 years, 5 months ago) by koli


Changes since 1.1: +0 -0 lines

Initial import

// Copyright (c) 2003 Juraj Kolesár (koli) <koli@koli.sk>               
int str_remove_char(int pos, char * str) {
    int i;
    int l=strlen(str);
    char m_str[l];
    strcpy(m_str,str);
    if (pos > l) return(1);
    for (i=0; i < pos; i++) {
        str[i] = m_str[i];
    }
    i++;
    for (i; i < l; i++) {
        str[i-1] = m_str[i];
    }
    str[i-1] = '\0';
    return(0);
}

int str_inc(char *str) {
    const int L = (strlen(str) - 1);
    if (str[L] > '9') str[L] = '1';
    else if ( (str[L] >= '0') && (str[L] < '9') ) str[L]++;
    else if (str[L] == '9') {
        str[L] = '\0';
        str_inc(str);
        str[L] = '0';
    }
    return(0);
}

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top