Jump to content
Developer Wiki and Function Reference Links ×

String Concatenate Issues


AlHanson

Recommended Posts

I've been using the Ordered List along with the Concatenate Node to combine strings for my tools for a while now and have never had any issue with it. Recently, I've been having trouble getting this to function correctly as it has started giving me a list style string.

 

In this example I'm just trying to create a simple #/# value display- just a simple / between two string values. I should be getting 1/23 from this however I'm getting ['1', '/', '23'].

 

I've generally been working with the ComputerWorks Easy Text node, so I checked this against the stock Text node and the problem exists here too. The weird thing is that if I go back to my tools that have used this exact same method to generate text and copy/paste the Ordered List & Concat nodes into the file they work just fine and produce the previously expected results. Checking the script in the newly inserted nodes versus the copied node shows no difference- they match up exactly. Example file attached.

 

Very confused with this and looking for some help or guidance on a better method for building strings?

Concat.jpg

TextConcat.vwx

Link to comment
  • 2 years later...

As the concat node is, it converts the input to a string and then loop the character and adds them.

    #inputs
    stringIn = str(self.Params.stringIn.value)
    
    #script
    newString = ''
    for s in stringIn:
        newString = newString + s
    
    #outputs
    self.Params.stringOut.value = newString


I am not sure but I would expect from this node, it should do something like this:

#inputs
stringIn = self.Params.stringIn.value

#script
newString = ''
for s in stringIn:
  newString = newString + str(s)

  #outputs
  self.Params.stringOut.value = newString

 

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