If I have a string of garbage like
this is a sentence that is stackoverflow’s property.
How can I read the string until the apostrophe (or the key I want to set up) is hit so it would return
this is a sentence that is stackoverflow
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You just need to find the first index of the character, then return the whole string if it isn’t found or the substring from the start of the string up to (but not including) the index of the character if it is.