#include <string.h>
      #include <ctype.h>
      #include <stdio.h>
      #include <stdlib.h>
      
      const char *
      ltrim(const char *s) {
      	while (isspace((unsigned char) *s)) {
      		s++;
      	}
      	return s;
      }
      

      C language logoTrim leading whitespace

      Codiga's C Recipes

      Whitespace is defined by isspace(). Returns a pointer into s, at the address of the first non-whitespace character. This should not be passed to free().

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.