Jump to content

deleting a portion of a string not an array


Recommended Posts

Posted

I have tried repeatably to delete the last few letters from a specific array. 

I can not get it to work with the subset function nor the delete portion of array function. 

 

Any suggestions?

Posted

Your post is a bit confusing as you're interchanging string and array terms. Cleaning that up and posting a bit of what you've tried would help people give better feedback. It sounds like you're using primitives that would do what you want, so it would be helpful to see how you are using them.

Posted

Michael, technically what you write is only true for an input array of exactly 5 elements. If you really always want to remove the last three elements the OP needs to use an Array Length node, subtract the number of elements he wants to remove from this length and wire that to the offset. In that case you can leave the size input unwired because it will default to the rest of the array.

Posted
14 hours ago, Rolf Kalbermatter said:

If you really always want to remove the last three elements the OP needs to use an Array Length node, subtract the number of elements he wants to remove from this length and wire that to the offset. In that case you can leave the size input unwired because it will default to the rest of the array.

That's too complicated.  Just wire the 3 to the Length and leave the Index unwired.  Delete From Array will default to deleting from the end.

  • Like 1
Posted

The OP didn't clarify his requirements so we could all be wrong. But ya, all you guys say is true. - Thanks.

My intent was to start the conversation, not to provide the best solution. I just wanted to show how the delete from array works and to provide some visuals.

Posted

Okay for the heck of it here is my interpretation.  I read that as OP trying to remove the last few characters from each string in an array.  (also I read "few" as 3).  Also snippets might not be working so attached is a VI in 2018.

Example_VI.png.48ad7231593e3dd1d5991455f4de8d04.png

Remove Strings Test.vi

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...

Important Information

By using this site, you agree to our Terms of Use.