String Manipulation


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2004
    Posts
    74

    Default String Manipulation

    Hi all,
    Just wondering if there is a way to manipulate string values for display? For example I am working on an A/D project and to overcome floating point issues I have calculated values based on the decimal point being 3 digits to the right making it an interger. What I am looking for is displaying the value in 2 parts. ! figure left of the decimal point followed by the point and then the figure right of the point. In VB I could use left$ or right $. is there any way to do this in PBP?


    Thanks

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You can do some math in the LCDOUT command and or use a number after the DEC like in the SEROUT2 command.
    Code:
    LCDOUT $FE,$C0,DEC numVar /100,".",DEC2 numVar //100
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's also DIG in the list.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    Thanks Mackrackit,
    Can you explain what you have suggested a little better so I can understand.

    thanks
    Darren

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrenmac View Post
    Thanks Mackrackit,
    Can you explain what you have suggested a little better so I can understand.

    thanks
    Darren
    I can try, but that cold med I took is having fun with with me

    LCDOUT $FE,$C0,
    display line two.

    DEC numVar /100
    displays the value of numVar

    "."
    makes a "."

    DEC2 numVar //100
    displays only two digits of the remainder of numVar divided by 100

    The math section and SEROUT2 section of the manual will explain it better I am afraid.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    thanks
    I will give it a go.

  7. #7
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    can you explain the difference between dec and dec2?

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    DEC will show the whole decimal number , while DEC2 will show only the 2 less significant one.

    MyVar=1234

    DEC MyVar =>1234
    DEC2 Myvar => 34
    DEC3 MyVar => 234
    etc
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. How about String Variables?
    By mytekcontrols in forum PBP Wish List
    Replies: 40
    Last Post: - 20th January 2015, 12:53
  2. Manipulation of string array
    By Benny007 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd April 2008, 20:50
  3. How to convert HEX Value as formatted BIN String ?
    By Robson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2007, 02:16
  4. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04:39
  5. Message String Table using Readcode
    By mytekcontrols in forum Code Examples
    Replies: 2
    Last Post: - 10th July 2005, 23:17

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts