How to resolve the algorithm String case step by step in the Action! programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm String case step by step in the Action! programming language

Table of Contents

Problem Statement

Take the string     alphaBETA     and demonstrate how to convert it to:

Use the default encoding of a string literal or plain ASCII if there is no string literal in your language. Note: In some languages alphabets toLower and toUpper is not reversable. Show any additional case conversion functions   (e.g. swapping case, capitalizing the first letter, etc.)   that may be included in the library of your language.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm String case step by step in the Action! programming language

Source code in the action! programming language

INCLUDE "D2:CHARTEST.ACT" ;from the Action! Tool Kit

PROC UpperCase(CHAR ARRAY text,res)
  BYTE i

  res(0)=text(0)
  FOR i=1 TO res(0)
  DO
    res(i)=ToUpper(text(i))
  OD
RETURN

PROC LowerCase(CHAR ARRAY text,res)
  BYTE i

  res(0)=text(0)
  FOR i=1 TO res(0)
  DO
    res(i)=ToLower(text(i))
  OD
RETURN

PROC Main()
  CHAR ARRAY text="alphaBETA"
  CHAR ARRAY upper(20),lower(20)

  UpperCase(text,upper)
  LowerCase(text,lower)

  Put(125) PutE() ;clear screen
  PrintF("Original string: ""%S""%E",text)
  PrintF("Upper-case string: ""%S""%E",upper)
  PrintF("Lower-case string: ""%S""%E",lower)
RETURN

  

You may also check:How to resolve the algorithm Active object step by step in the Nim programming language
You may also check:How to resolve the algorithm SHA-1 step by step in the Nim programming language
You may also check:How to resolve the algorithm UPC step by step in the AWK programming language
You may also check:How to resolve the algorithm Pangram checker step by step in the VTL-2 programming language
You may also check:How to resolve the algorithm Factors of a Mersenne number step by step in the Factor programming language