I am trying to remove part of a string and place it into another variable
the string is a filename
eg
"C:\help\demo\s ample.txt"
I want to remove and resave into a new string just the file name i.e "sample.txt "
my thinking was to count backward to the point where the last "\" was and store this integer value and then delete all parts before.
another idea was to split the string into 2 parts and store the "sample.txt " in one and the rest in another.
I am a bit stuck at present with this and was hoping to be pointed in the right direction?
i.e the file name will change continuously so the best method would be just the lacte the last "\" and either spilt or delete before.
Can you help?
Thanks
the string is a filename
eg
"C:\help\demo\s ample.txt"
I want to remove and resave into a new string just the file name i.e "sample.txt "
my thinking was to count backward to the point where the last "\" was and store this integer value and then delete all parts before.
another idea was to split the string into 2 parts and store the "sample.txt " in one and the rest in another.
I am a bit stuck at present with this and was hoping to be pointed in the right direction?
i.e the file name will change continuously so the best method would be just the lacte the last "\" and either spilt or delete before.
Can you help?
Thanks
Comment