Welcome to the Builder Academy

Question Bug in Drink containers

More
05 Jun 2020 20:28 #8755 by thomas
Replied by thomas on topic Bug in Drink containers
strictly speaking, the ltrim() function right trims

Please Log in or Create an account to join the conversation.

More
07 Jun 2020 12:37 #8766 by WhiskyTest
Replied by WhiskyTest on topic Bug in Drink containers
Thanks Thomas!
I've made your suggested changes and tested - looks good so far :)

I renamed the new functions and put them into Utils.c as the may come in handy for other features.

I've created a pull request on GitHub
The following user(s) said Thank You: thomas, lacrc

Please Log in or Create an account to join the conversation.

More
08 Jun 2020 18:43 #8770 by cunning
Replied by cunning on topic Bug in Drink containers
I have been using it for a while. here are two complimentary functions as well.
Code:
char *ltrim (char *arg) { for (; isspace((int)(*arg)); arg++); return (arg); } char *rtrim (char *arg) { while (*(arg+(strlen(arg)-1)) == ' ') { *(arg + (strlen(arg) -1)) = '\0'; } return (arg); } char *trim (char *arg) { for (; isspace((int)(*arg)); arg++); while (*(arg+(strlen(arg)-1)) == ' ') { *(arg + (strlen(arg) -1)) = '\0'; } return (arg); }

Please Log in or Create an account to join the conversation.

Time to create page: 0.201 seconds