Jump to content

Now I want to convert String to integer?


Recommended Posts

I want to save the month with only one character

1-9 is not a problem

But 10,11,12 needs to saved as

10-O                      (December)

11-N                      (November)

12-D                       (December)

 

I am using mm//dd for RTC

I used function:( string to left )to find the two numbers

Now I want to convert String to integer?

How can I do that?

image.png.ac3100e743c41e65957c091f17cd4a79.png

Link to comment
Share on other sites

4 hours ago, Joe Tauser said:

You're not telling us what the error is.  Do a screenshot of it.

You're putting multiple logical statements in the same network again, as you did in another post.   This should be three networks.

You should store your factor (MI 889) before you call your function blocks.

 

Joe T.

Thank you so much Joe.L, like you said removing from the same ladder solved the problem.

 

 

I have one problem now

I have number and String,

I want to concatenate them. I tried to using Num to Ascii function, but this did not do it.

 

Eg

String1=”abc”

Mi 1= 100

Sting Final=”abc100”

How could I do this?

image.png.f7d1362d195efc6c2cf5fe495411fb7b.png

Link to comment
Share on other sites

  • MVP 2023

This a more complicated problem.  Since Unitronics Vision doesn't have string data types, you need to track where your characters are in the MI table.  There is no "concatenate" function so the problem needs to be broken down to the byte level.

Before you solve the problem you'll need to define your initial possible conditions.  How big with the number be?  How long can the string get?

You'll need a block of MIs to be a buffer for your manual string manipulation.

Step one is to determine the length of the string.

Step two is to move the string to the beginning of the buffer.

Step three is to convert the number to a string and also determine its length.

Step four is to move this "number string" to the tail end of the first string using the Vector Copy with Offset function.

 

Clear as mud, I know.  Have a go at it.

 

Joe T.

  • Like 1
Link to comment
Share on other sites

29 minutes ago, Joe Tauser said:

This a more complicated problem.  Since Unitronics Vision doesn't have string data types, you need to track where your characters are in the MI table.  There is no "concatenate" function so the problem needs to be broken down to the byte level.

Before you solve the problem you'll need to define your initial possible conditions.  How big with the number be?  How long can the string get?

You'll need a block of MIs to be a buffer for your manual string manipulation.

Step one is to determine the length of the string.

Step two is to move the string to the beginning of the buffer.

Step three is to convert the number to a string and also determine its length.

Step four is to move this "number string" to the tail end of the first string using the Vector Copy with Offset function.

 

Clear as mud, I know.  Have a go at it.

 

Joe T.

What does 

"Step two is to move the string to the beginning of the buffer" mean??

Link to comment
Share on other sites

If the purpose is to display that on screen, I  find easier to use string library to concatenate and make more complex string text based on other information:

 

image.thumb.png.9e2a443eee304e48172d533f38def911.png

 

In this case  I have a composite duration  . I track the Hrs. as an Integer, then convert to ASCII, then link that value on String variable,

Then I just select in the screen the String from library to display as an ascii :

image.png.1553b0d4aeb2cb8f5c1751133dd1be6d.png

 

 

  • Thanks 2
Link to comment
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...