LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Ryan_Wright_

Add Delete From String Function to LabVIEW

Status: Already Implemented

As described by raphschru, the Replace Substring function can be used to remove a section of a string based on index and length. Additionally, you can use the Search and Replace String function (with an empty 'replace string') to remove a section of a string based on its value.

 

string.png

If I'm not mistaken, there currently isn't a single function that deletes a certain number of characters from a string. This can be done in a variety of ways using existing string functions, such as the example shown in the picture below. It would be really nice if LabVIEW contained a Delete From String function with offset and length inputs as illustrated in the same picture below. If you didn't wire up the length, maybe it could delete the remainder of the string and maybe an unwired offset could default to 0, similar to the String Subset function.

 

Ryan_Wright__0-1729872792549.png

 

5 Comments
crossrulz
Knight of NI

Another option is to use the String To Byte Array (which is a no-op), Delete From Array, and then Byte Array To String (another no-op).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
raphschru
Active Participant

Use "Replace Substring" with an unwired or empty replacement string:

 

raphschru_0-1729880963349.png

 

Regards,

Raphaël.

Darren
Proven Zealot
Status changed to: Already Implemented

As described by raphschru, the Replace Substring function can be used to remove a section of a string based on index and length. Additionally, you can use the Search and Replace String function (with an empty 'replace string') to remove a section of a string based on its value.

 

string.png

Ryan_Wright_
Member

Thanks for the feedback, everyone. I had forgotten about these ways of deleting characters from a string.

wiebe@CARYA
Knight of NI

>@crossrulz:Another option is to use the String To Byte Array (which is a no-op), Delete From Array, and then Byte Array To String (another no-op).

 

It's not entirely a no-op.

 

The combination turns a sub array into a normal array, and this could significantly effect performance:

 

wiebeCARYA_0-1730204155574.png