How to resolve the algorithm Show ASCII table step by step in the FutureBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Show ASCII table step by step in the FutureBasic programming language

Table of Contents

Problem Statement

Show  the ASCII character set  from values   32   to   127   (decimal)   in a table format.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Show ASCII table step by step in the FutureBasic programming language

Source code in the futurebasic programming language

include "NSLog.incl"

local fn ASCIITable as CFStringRef
  NSinteger   i
  CFStringRef temp
  
  CFMutableStringRef mutStr = fn MutableStringWithCapacity( 0 )
  for i = 32 to 127
    temp = fn StringWithFormat( @"%c", i )
    if i ==  32 then temp = @"Spc"
    if i == 127 then temp = @"Del"
    MutableStringAppendString( mutStr, fn StringWithFormat( @"%-1d : %@\n", i, temp ) )
  next
  
  CFArrayRef colArr = fn StringComponentsSeparatedByString( mutStr, @"\n" )
  MutableStringSetString( mutStr, @"" )
  for i = 0 to 15
    ObjectRef col0 = fn StringUTF8String( fn ArrayObjectAtIndex( colArr, i      ) )
    ObjectRef col1 = fn StringUTF8String( fn ArrayObjectAtIndex( colArr, i + 16 ) )
    ObjectRef col2 = fn StringUTF8String( fn ArrayObjectAtIndex( colArr, i + 32 ) )
    ObjectRef col3 = fn StringUTF8String( fn ArrayObjectAtIndex( colArr, i + 48 ) )
    ObjectRef col4 = fn StringUTF8String( fn ArrayObjectAtIndex( colArr, i + 64 ) )
    ObjectRef col5 = fn StringUTF8String( fn ArrayObjectAtIndex( colArr, i + 80 ) )
    MutableStringAppendString( mutStr, fn StringWithFormat( @"%-10s %-10s %-10s %-10s %-10s %-10s\n", col0, col1, col2, col3, col4, col5 ) )
  next
end fn = fn StringWithString( mutStr )

NSLog( @"%@", fn ASCIITable )

HandleEvents

  

You may also check:How to resolve the algorithm Gray code step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Largest number divisible by its digits step by step in the RPL programming language
You may also check:How to resolve the algorithm Pisano period step by step in the Python programming language
You may also check:How to resolve the algorithm Bitcoin/public point to address step by step in the Factor programming language
You may also check:How to resolve the algorithm Return multiple values step by step in the XPL0 programming language