How can I split a string?
I would like to turn C:\RoamingFiles\D\file.txt to D:\file.txt.
I’m not sure how to do it, as split won’t filter out C:\RoamingFiles\ as I want.
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.
I’m a little confused as to what exactly you want
-splitto do here. It seems likewould work better for what you seem to be doing there. This essentially replaces the path component
C:\RoamingFiles\with the drive letter that follows. But this is all pretty much guesswork since you gave only one example.