How to resolve the algorithm Strip whitespace from a string/Top and tail step by step in the TUSCRIPT programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Strip whitespace from a string/Top and tail step by step in the TUSCRIPT programming language
Table of Contents
Problem Statement
Demonstrate how to strip leading and trailing whitespace from a string. The solution should demonstrate how to achieve the following three results:
For the purposes of this task whitespace includes non printable characters such as the space character, the tab character, and other such characters that have no corresponding graphical representation.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Strip whitespace from a string/Top and tail step by step in the TUSCRIPT programming language
Source code in the tuscript programming language
$$ MODE TUSCRIPT
str= " sentence w/whitespace before and after "
trimmedtop=EXTRACT (str,":<|<> :"|,0)
trimmedtail=EXTRACT (str,0,":<> >|:")
trimmedboth=SQUEEZE(str)
PRINT "string <|", str," >|"
PRINT "trimmed on top <|",trimmedtop,">|"
PRINT "trimmed on tail <|", trimmedtail,">|"
PRINT "trimmed on both <|", trimmedboth,">|"
You may also check:How to resolve the algorithm 99 bottles of beer step by step in the 8080 Assembly programming language
You may also check:How to resolve the algorithm Stirling numbers of the first kind step by step in the C programming language
You may also check:How to resolve the algorithm Make directory path step by step in the Ada programming language
You may also check:How to resolve the algorithm Hello world/Text step by step in the Minimal BASIC programming language
You may also check:How to resolve the algorithm Count in factors step by step in the Ruby programming language