Hello and thank you for any help. I have a variable called strReqType that pulls a string from a website. As a variable, each time I pull the variable the contents are different
Examples:
Claims - claims handling
Complaint - driver issue
Service request - send copies
Customs inquiry - customs process
etc
What I want to remove in the variable is the last space before the dash and the dash and everything after it. I have about 25 of the first half of the variable and dozens of the second half. How can I accomplish this task?
@Mr_Meeseeks - Thank you, I want to remove also the space before the dash so should it be
Assign strReqType to strReqType.tostring.split(" -"c)(0).Trim
?
@Palaniyappan - Thank you, In several cases I have more than one word to the left of the hyphen. Iām not sure how your code would keep the right parts. I want to delete everything to the right of the hyphen and also delete the space before the hyphen
yah sure it would
let me tell you how it works
so our expression is Split(Str_input,ā-ā)(0).Trim
and the input is if Str_input = Claims - claims handling
then the above expression will split like this
input : Claims - claims handling
splitting : Claims |-| claims handling
0 (our delimiter -) 1
where
0 = Claims* (* is the space)
delimiter = -
1 = claims handling ( is the space)
i have used pipeline symbol for how it would work if we have one word before to that -
and TRIM method will remove those spaces i.e, the place where * is mentioned
and if we have more than one word or even a sentence before -
like this
input : Customs inquiry |-| customs process
splitting : 0 (out delimiter -) 1
where
0 = Customs inquiry*
delimiter = -
1 = *customs process
so whatever that comes before - will get splitted with this expression and as we have mentioned only 0 in the expression it will give us only the value before to the delimiter 0
@Palaniyappan - Thank you for the explanation. As long as your piece of code removes the space before the hyphen and the hyphen and everything afterwards I should be good. The reason this matters is because next I will use a series of IF statements to search for the first half of the string strReqType and if the space is there it will fail.
I am on vacation until 10/28 and I will insert your idea into my process and see what happens. Thank you!