I am looking to crop a String based on a "/". I want to crop out everything to the right of the "/" as well as the " " that is to the left of it. I ultimately want only that which is to left of " /".
As always your help is greatly appriciated.
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Greg Maxey - 14 Nov 2006 18:45 GMT
Not sure I copy what it is that you are seeking (you want to crop out
everything to the right of ... as well as everything to the left of).
Whouldn't that leave you with /?
Do you mean you want to keep everything to the left? If so, perhaps:
Sub Scratchmacro()
Dim pStr As String
Dim i As Long
pStr = "Day 7 of a / new dark age"
MsgBox Left(pStr, InStr(pStr, "/"))
End Sub
> I am looking to crop a String based on a "/". I want to crop out everything to the right of the "/" as well as the " " that is to the left of it. I ultimately want only that which is to left of " /".
>
> As always your help is greatly appriciated.
>
> EggHeadCafe.com - .NET Developer Portal of Choice
> http://www.eggheadcafe.com
Andrew V - 14 Nov 2006 21:16 GMT
myStr = "before / after"
'value of myStr is "before / after"
myStr = Split(myStr," /")(0)
'value of myStr is "before"
Andrew V
> I am looking to crop a String based on a "/". I want to crop out everything to the right of the "/" as well as the " " that is to the left of it. I ultimately want only that which is to left of " /".
>
> As always your help is greatly appriciated.
>
> EggHeadCafe.com - .NET Developer Portal of Choice
> http://www.eggheadcafe.com