I want to reduce the number of characters

I want to shorten sentences in ifElseif

I wrote it like this

Partname = “광명생산관리1부” or Partname = “광명생산관리2부” or Partname = “광명생산관리3부”

Please tell me how to write short sentences

Hi @user118

Try this

If Partname.Contains("광명생산관리")

Regards,

HI,

Can you try the following expression?

System.Text.RegularExpressions.Regex.IsMatch(Partname,"광명생산관리[1-3]부")

image

Regards,

Thank you for your reply
but I want more names in the part name.

I wrote it like this

Partname = “광명생산관리1부” or Partname = “광명생산관리2부” or Partname= “화성생산관리1부”

Similar names as well as other names should be included.

@user118

You can combine Contains for patterns (like "생산관리") and OR for names that don’t follow the same pattern.

(Partname.Contains("광명생산관리") Or Partname.Contains("화성생산관리") Or Partname = "기타생산관리")

Regards,

Is there a rule about which part is a fixed or dynamic string?

No there are no special rules

This is just an example, but there are actually many.

Thank you for reply.I try it

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.