Jump to content
JOYE

String to Num

Recommended Posts

By the way, the answer to your question, @JOYE, is that FACTOR is how you deal with the decimal placement since you are converting the string representation to an integer. If the string looks like this: "123.45", then you would use a factor of 100 to result in an integer value of 12345. You can then display this integer number on the HMI screen and identify where to place the decimal. If you use the number in calculations, you would need to account for the fact that the number has been multiplied by 100 and deal with that properly.

Share this post


Link to post
Share on other sites

I had a crash course in UniLogic string to num conversions (formatting/handling). You have to remove leading spaces and trailing non numeric characters if I recall correctly. The Visilogic string to num FB is more flexible as to what it will convert. If your ASCII string is purely numeric characters you should be Okay. If you need a subroutine to strip off other characters let me know. I could share a snippet of code I used. 

  • Upvote 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...