Analysis of the workpart name

Hello! I need some help..

Depending on the workpart name mask is need perform a version code A or B.
name mask for code A: xx.xxxx.x.xxxx.xxx or xx.xxxx.x.xxxx.xxx_pxx
name mask for code B: xx.xxxx.x.xxxx.xxx_kxx

if mask A then
Code A
...
...

if mask B then
Code B....
........
......

How to write this in journal? Please!

As a first attempt, I'd try something like:

if partName.Contains("_k") then
'use code B
else
'use code A
end if

It's easy and working, thanks.

But how to refer on the workpart name?
partname as string = workpart.name
Or..
if workpart.name.contains("_k")
not working

If you are working with native NX (no PDM/PLM), you can get the part name by using the .Leaf property.

{part reference}.Leaf

If you need to include the path information, you can use the .FullPath property.

{part reference}.FullPath

Both properties are working!
Thank you so much!!!