how to TRIM BEGINNING and END BLANK spaces in STRING???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • metalinc
    New Member
    • Jan 2007
    • 14

    how to TRIM BEGINNING and END BLANK spaces in STRING???

    hi!
    i need help in C programming to TRIM BEGINNING and END BLANK spaces in STRING.....
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by metalinc
    hi!
    i need help in C programming to TRIM BEGINNING and END BLANK spaces in STRING.....
    have a look at tutorials on string manipulation in C, e.g.
    http://www.cprogrammin g.com/tutorial/lesson9.html

    Comment

    • metalinc
      New Member
      • Jan 2007
      • 14

      #3
      nothing there on removing BEGINNING and END BLANK spaces....

      are there any function to use?

      Comment

      • horace1
        Recognized Expert Top Contributor
        • Nov 2006
        • 1510

        #4
        Originally posted by metalinc
        nothing there on removing BEGINNING and END BLANK spaces....

        are there any function to use?
        If you can work in C++ you could use function find_first_not_ of() in class <string>
        http://www.cppreferenc e.com/cppstring/index.html

        otherwise if you are working in C is to search the character array for the first non space character then copy the characters from that point into another array. When that is working you can then reverse search the resultant sting replacing the first of the trailing spaces with a '\0'

        Comment

        Working...