How to remove unnecessary value from string

I have strJobProfile variable which value has AMRPM285P03 - Sr. Project Manager
from above string i wanted remove - Sr. Project Manager how can i do this

You can split the string or use regex

Split(strJobProfile,(“-”))(0).Trim

Trim removes blank space.
(0) keeps whats before the “-”
“-” is the charactetr your splitting on

Check out academy for learning about the basics:

@Sandhya_Gajare

string strJobProfile = "AMRPM285P03 - Sr. Project Manager";
string modifiedString = strJobProfile.Replace(" - Sr. Project Manager", "");

This will replace the specified text with an empty string and store the modified string in the modifiedString variable.