Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Remove everything after "("

I read values like this from the database:
Public_Site_Testing2.docx (11 k)
ABC.pdf (30 k)
test.doc (244 k)

Always a space before "(". I want to remove everything after "("  and just have the filename.

How can I do this?
SOLUTION
Avatar of Fab_C
Fab_C
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cyberkiwi
I would use IndexOf, which would return the first (or only) match instead of the last... but the code by fab_c is good.  You might want to add an if statement so that if "(" does not exist, it still returns the name instead of blank.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial