* Function: str_trim Description: effectively removes all leading and trailing whitespace from the given string s. Examples: BEFORE AFTER abc" "abc" abc "abc" hello there "hello there" a b "а b" Estimated Difficulty: LEVEL 3 * NOTES/COMMENTS: Notice that "internal" whitespace is not removed! Modifications are made to the given string -- you are not creating a new string. Use the library function isspace to test if a character is whitespace or not. is whitespace, it is not the only whitespace char; the tab character '\t' for example is considered While the usual space character whitespace. Let the isspace function figure this out for vou

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Write a str trim function in C 

* Function: str_trim
Description: effectively removes all leading and trailing
whitespace from the given string s.
Examples:
BEFORE
AFTER
abc"
"abc"
abc
"abc"
hello there
"hello there"
a b
"а b"
Estimated Difficulty: LEVEL 3
* NOTES/COMMENTS:
Notice that "internal" whitespace is not removed!
Modifications are made to the given string -- you are
not creating a new string.
Use the library function isspace to test if a character
is whitespace or not.
is whitespace, it is not the only whitespace char;
the tab character '\t' for example is considered
While the usual space character
whitespace.
for you.
Let the isspace function figure this out
void str_trim(char *s);
Transcribed Image Text:* Function: str_trim Description: effectively removes all leading and trailing whitespace from the given string s. Examples: BEFORE AFTER abc" "abc" abc "abc" hello there "hello there" a b "а b" Estimated Difficulty: LEVEL 3 * NOTES/COMMENTS: Notice that "internal" whitespace is not removed! Modifications are made to the given string -- you are not creating a new string. Use the library function isspace to test if a character is whitespace or not. is whitespace, it is not the only whitespace char; the tab character '\t' for example is considered While the usual space character whitespace. for you. Let the isspace function figure this out void str_trim(char *s);
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr