Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MARIE Simulator answers only. Basically i have to create a subroutine TrimString which will remove any space characters before and after a String. For example,

MARIE Simulator answers only. Basically i have to create a subroutine TrimString which will remove any space characters before and after a String. For example, where _ represents a blank, __MARIE__ becomes MARIE after trimming it.

The String has to be trimmed in 2 phases,

The first phase removes any trailing space (i.e., spaces at the end of the string).

Your code should follow these steps to achieve the result: 1. Iterate through the string, one character at a time, until you reach the end of the string (the 0 character). This is similar to how the PrintString subroutine works, just without actually printing the characters. 2. In step 1, you found the address of the nal 0 in the string. Now iterate backwards, and replace any space character (decimal 32) with a 0, until you reach a character that is not a space character, or the beginning of the string.

The second phase removes leading space characters. This approach modifies the start address of the string, up- dating it to the rst non-space character. 1. Iterate through the string, one character at a time, until you reach a character that is not the space character (decimal 32). 2. Update the start address of the string (at label TrimStringAddr) to the address you found in step 1 (the address of the first non-space character).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Question Can I collect benefits if I become disabled?

Answered: 1 week ago

Question

Question May I set up a Keogh plan in addition to an IRA?

Answered: 1 week ago