iLogic trim File Name

iLogic trim File Name

Cosmin_V
Advocate Advocate
609 Views
3 Replies
Message 1 of 4

iLogic trim File Name

Cosmin_V
Advocate
Advocate

Hello Everybody,

 

I want to use the File Name as

iProperties.Value("Summary", "Subject")

But the File Name get prefix and suffix some times.

If dose it will always be like...

0010-Dust Bin-T1-234567

and I need just "Dust Bin" as iProperties, how can I trim first 5 and last 10 characters if they were added.

 

 

Many Thanks!

0 Likes
610 Views
3 Replies
Replies (3)
Message 2 of 4

Curtis_Waguespack
Consultant
Consultant

Hi @Cosmin_V 

 

@There are a few ways this could be done, but using the Split function to split the string using the dashes is one way that works well.

 

see this link for an example:

https://forums.autodesk.com/t5/inventor-customization/ilogic-part-name/m-p/9340784#M106268

Hope that helps, Curtis 

 

EESignature

0 Likes
Message 3 of 4

WCrihfield
Mentor
Mentor

@Cosmin_V 

Here's a couple more examples of how to trim the String.

 

Dim oOldName As String = "0010-Dust Bin-T1-234567"
Dim oNewName As String = Mid(oOldName, 6, 8)
MsgBox(oNewName)

 

And

 

Dim oOldName As String = "0010-Dust Bin-T1-234567"
Dim oNewName As String = oOldName.Substring(5,8)
MsgBox(oNewName)

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor
0 Likes