S
S
Steve2019-04-15 23:19:27
C++ / C#
Steve, 2019-04-15 23:19:27

How to remove tab elements at the end of a line?

At the beginning, I removed it all (although it’s shitty code), but I don’t understand how to remove it at the end

int main(int argc, char *argv[])
{
    char str[101] = "\t\v\n   Lorem ipsum dolor sit amet, consectetur adipiscing elit.\t\v\n";
    char res[101] = "";
    int count = 0;


    for (int i = 0; i < strlen(str); ++i)
    {
        if (str[i] >= 'A' && str[i] <= 'Z' || str[i] >= 'a' && str[i] <= 'z')
        {
            for (int j = 0; j < strlen(str); ++j)
            {
                res[j] = str[i];
                i++;
            }
            break;
        }
    }
    printf("Result: %s\n", res);
    return 0;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-04-15
Gorton

microsin.net/programming/arm/trim-c-cpp.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question