Showing results for 
Search instead for 
Did you mean: 

Splitting Strings by Character Number

Go to solution

I'm trying to find a way to differentiate duplicates of files based off of their revision. Two files are the same but of different revision if they have the same file name, but a different suffix (always a capital letter) at the end.


For instance:

are both of the same file but of a different revision.

are of different files and different revisions.


My problem is that I need to be able to determine if two files are the same but of different revisions. My idea for a solution was to strip the file extension, then split the remaining string into two, one being n-1 characters long, and the other being 1 character long. Is there a way to do this? All split string methods I've seen so far either require a complete match or a delimiter.



0 Kudos
Message 1 of 5
Accepted by topic author reesl

Use "String Subset"


string subset.png

Message 2 of 5

To add to Prettypwnies anser:



G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
0 Kudos
Message 3 of 5



Search and Replace string to find the location of your period (start of your file extension), decremented to get the rev digit, and fed into string subset of length 1 to pull out the character of interest.   

0 Kudos
Message 4 of 5

If the string format is really that easy (and stays that easy) use Scan From String.


Use format specifier "%[A-Z]%d%[A-Z]" (characters in string, number, characters in string), and you'll get the string and number as output (extract to get 3 outputs). Optionally, use "%[A-Z]%d%[A-Z].%s" to also get the extension.


Once you have the results, you can either use a set (new in LV2019), variant attributes or an array to spot duplicates. Not sure if that's the showstopper, but we can help once you're there.

File Format.PNG

0 Kudos
Message 5 of 5