How to resolve the algorithm Substring step by step in the Maple programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Substring step by step in the Maple programming language

Table of Contents

Problem Statement

Display a substring:

If the program uses UTF-8 or UTF-16,   it must work on any valid Unicode code point, whether in the   Basic Multilingual Plane   or above it. The program must reference logical characters (code points),   not 8-bit code units for UTF-8 or 16-bit code units for UTF-16. Programs for other encodings (such as 8-bit ASCII, or EUC-JP) are not required to handle all Unicode characters.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Substring step by step in the Maple programming language

Source code in the maple programming language

> n, m := 3, 5:
> s := "The Higher, The Fewer!":
> s[ n .. n + m - 1 ];
                     "e Hig"

> s[ n .. -1 ] = s[ n .. ];
 "e Higher, The Fewer!" = "e Higher, The Fewer!"

> StringTools:-Drop( s, n - 1 );
              "e Higher, The Fewer!"

> s[ 1 .. -2 ] = s[ .. -2 ];
"The Higher, The Fewer" = "The Higher, The Fewer"

> StringTools:-Chop( s );
             "The Higher, The Fewer"

> pos := searchtext( ",", s ):
> s[ pos .. pos + m - 1 ];
                     ", The"

> pos := searchtext( "Higher", s ):
> s[ pos .. pos + m - 1 ];         
                     "Highe"

  

You may also check:How to resolve the algorithm Problem of Apollonius step by step in the Liberty BASIC programming language
You may also check:How to resolve the algorithm Periodic table step by step in the Quackery programming language
You may also check:How to resolve the algorithm Introspection step by step in the Scala programming language
You may also check:How to resolve the algorithm Even or odd step by step in the ERRE programming language
You may also check:How to resolve the algorithm Evaluate binomial coefficients step by step in the Scheme programming language