Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Convert String To Integer / Real

Convert String To Integer / Real

Convert String To Integer / Real

Hi, sorry if this seem a bit of a simply ? but i only have a need to write very basic programs.

I have to write a small programme to read a serial output from a device and represent the level data on a touch screen.

The screen can only show levels that are real/integer values.

I have stripped the relevant byte of level information with


I then try and ZONE1LEVEL:=STRINGTOINT byte 6 from above data, but ZONE1LEVEL always = 0.

With my limited knowledge stringtoint will result in 0 if the data to be converted is not something or other.

Byte 6 above will be in the range of #00 to #64

Any help greatly received.

RE: Convert String To Integer / Real

Try the Val procedure

Val( TextVal, Number , Code) which converts String to a number.
  if this is possible the result of code = 0, other wise code indicates the character where
the error occurred


    Textval := '354';
    Val(Textval, Number, Code)  ---> Code = 0, Number = 354

   Textval := '37645x2';
   Val( Textval, Number, Code)  ---> Code = 6,  Number remains unchanged;


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close