ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reduce string size

Solved!
Go to solution

Hello,

 

I would like to have only the last 2 digit of my string.

 

Exemple : I have a result in string "28C" but I would like only take 8C (the result change every time so this is only a exemple).

 

Can you help me please ?

 

Thanks.

0 Kudos
Message 1 of 7
(4,469 Views)
Solution
Accepted by Zek67

Use "String Subset" and "String Length"

0 Kudos
Message 2 of 7
(4,463 Views)
Solution
Accepted by Zek67

Other option:

ReverseString, take first 2 chars using StringSubset, ReverseString…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(4,455 Views)

Thank you very much.

0 Kudos
Message 4 of 7
(4,445 Views)

@Zek67 wrote:

I would like to have only the last 2 digit of my string.


Just to add to the fun...

String To Byte Array, Delete From Array with the length set to 2 (do not wire up the index), and then Byte Array To String with the "Deleted Subset".



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
0 Kudos
Message 5 of 7
(4,402 Views)

To add more: Match Regular Expression with the following regex .{2}$

 

Ben64

Message 6 of 7
(4,384 Views)

@ben64 wrote:

To add more: Match Regular Expression with the following regex .{2}$

 

Ben64



I always love it when one of the Gurus of Regex posts a regex solution to a string issue because I always learn from it.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 7
(4,357 Views)