Testers needed. I need a few hours of your time to test a new STRINGS.H

Anobium
2014-01-30
2014-02-02
  • Anobium
    Anobium
    2014-01-30

    I am in the later stages of completing a new STRINGS.H.

    New functionality/changes are shown below:

    • LEN_SW – publish this to the help file. You have added this function but it is not in the help
      file. This is a software implementation.
    • LEN – publish this to the help file. You have added this function but it is not in the help
      file. This is a compiler implementation - this will be faster (this code will not be included in this release).
    • TRIM – New method out and publish this to the help file.
    • LTRIM – New method out and publish this to the help file.
    • RTRIM – sort this method out and publish this to the help file.
    • ASC – new method for ASCII value of string character and publish this to the help file.
    • CHR – new method for string value of byte value and publish this to the help file.

    I need a few willing persons to test the new code. Please reply to this posting if you are willing to assist next week.

    I will delete this posting once we have the testing completed. Expect a few more postings like to get a little more testing completed.

     
    Last edit: Anobium 2014-01-30
  • Anobium
    Anobium
    2014-01-31

    I want to clarify.... I have been asked a question via a private message.

    These changes are intended to be included in future releases and these updates are part of the development program which Hugh is leading.

    Anyone willing to help? Please drop me an email.

     
    Last edit: Anobium 2014-01-31
  • Anobium
    Anobium
    2014-02-01

    See https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/lowlevel/string.h for a revised string.h

    New functionality/changes are shown below:
    LEN – length of a string. This a numeric function. LEN (string) returns a numeric value of the length of the string.
    TRIM – trim a string. This a string function. TRIM(string) returns a string value with white spaces removed from both ends of the string.
    LTRIM – left trim a string. This a string function. LTRIM(string) returns a string value with the left hand spaces removed.
    RTRIM – right trim a string. This a string function. RTRIM(string) returns a string value with the right hand space removed.
    ASC – ASCII value of string character.This a numeric function. ASC(string) returns a numeric value of the first character or ASC(string, pos) returns the numeric value of character within a string at pos (position), where pos is optional. Converts character with string to a ASCII number.
    CHR – String of a byte value. This a string function. CHR ( number) returns a string value of the numeric as a string. Converts ASCII number to character string.

     
  • Anobium
    Anobium
    2014-02-01

    Code I used to test the new functions is attached. It is not really that well documented but it works.

    I will update help files asap.

     
    Attachments
  • Anobium
    Anobium
    2014-02-02

    Results of the testing.

    Started: New Strings 001

    Show the ASCII value of the string, with no parameter therefore the first char '123456'
    49
    Show the ASCII value of the string, with 2 as the parameter therefore the second char '123456'
    50

    Show the ASCII value of the string, with an empty string ''
    0
    Show the BytetoBin strings
    ByteToBin( 0x55 ) = 01010101
    WordToBin( 32767 ) = 1111111111111111
    Show the SWAP4 value of the byte '0x12'
    21
    Show the Average value of two numbers '8 and 4'
    6

    Show the ASCII value of the string, char by char

    1234567890ABCDEF = 49,50,51,52,53,54,55,56,57,48,65,66,67,68,69,70,

    Show the CHR value of the array of numbers
    Where the array is array = 0x31, 0x32, 0x33, 0x34, 0x35, 0x36
    1,2,3,4,5,6,

    Ltrim examples
    a single space
    lots of spaces
    empty string
    0 none
    12 none
    34 left 1
    56 left 2
    78 * left 1 right 1
    9 A left 2
    B C * left 1 right 1
    Test completed for ltrim

    Rtrim examples
    D E left 2 right 2
    empty
    lots
    Test completed for rtrim

    Trim examples
    123 456 l 2
    ABCabc r 2
    ABCabc l 1 r 1
    ABCabc none

    ** empty string

    Test completed for trim

    End of tests