Jump to content
Developer Wiki and Function Reference Links ×

string to real number


Rob87

Recommended Posts

Hi there!

 

I need a node which converts strings 'str' into real numbers 'n', to use them with math nodes. 

Because only digit strings can be converted, there should be two outputs:

First output = n -> number if successfully converted

Second output = sF -> the original string if it could not be converted

 

F.e.:

 

Input 'hObj':

[0] = 1 - TYPE: <class 'str'>

[1] = 2 - TYPE: <class 'str'>

[2] = 31 - TYPE: <class 'str'>

[3] = 1e - TYPE: <class 'str'>

 

Output 'n':

 [0] = 1.0 - TYPE: <class 'float'>

 [1] = 2.0 - TYPE: <class 'float'>

 [2] = 31.0 - TYPE: <class 'float'>

 

Output 'sF'

  [0] = 1e - TYPE: <class 'str'>

 

Can anybody help me out? That would be awesome!

 

Thank you!

Link to comment

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.   Restore formatting

  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...