If I have a string, e.g.
setting=value
How can I remove the ‘=’ and turn that into two separate strings containing ‘setting’ and ‘value’ respectively?
Thanks very much!
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.
Two options spring to mind.
The first
split()s theStringon=:The second uses regexes directly to parse the
String:The second gives you more power. For example you can automatically lose white space if you change the pattern to: