Complete this function that produces a string from the given string with all blank spaces removed. Use new to allocate the result. (It is the caller's responsibility to delete the returned string.) Don't modify the original string.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question
Complete this function that produces a string from the given string with all blank spaces removed. Use new to allocate the result. (It is the caller's responsibility to delete the returned string.) Don't modify the original string.
strings.cpp
1 finclude <cstring>
using namespace std;
4
char* no blanks (const char* str)
6.
int len - strlen(str);
char• result = . . .;
int j - 0;
for (int i = e; i< len; i++)
{
if (str[i] !=
15
}
..
17
18
return result;
19 }
Transcribed Image Text:Complete this function that produces a string from the given string with all blank spaces removed. Use new to allocate the result. (It is the caller's responsibility to delete the returned string.) Don't modify the original string. strings.cpp 1 finclude <cstring> using namespace std; 4 char* no blanks (const char* str) 6. int len - strlen(str); char• result = . . .; int j - 0; for (int i = e; i< len; i++) { if (str[i] != 15 } .. 17 18 return result; 19 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT