Cutting Folder from a String
Hey everybody,
For my plugin I need to cut-off the folder of a string to create it if it doesn't exist, but I couldn't find any existing method to do that. Anyone has an Idea how to do that? String Format (Examples) : Quote:
Quote:
|
Re: Cutting Folder from a String
Why don;t you use replace and then check if altered string is a valid folder?
|
Re: Cutting Folder from a String
What do you want to replace?
|
Re: Cutting Folder from a String
You could iterate backward through the string and when you find the '/', replace it with a 0.
|
Re: Cutting Folder from a String
How do I that backward? :o
|
Re: Cutting Folder from a String
Quote:
|
Re: Cutting Folder from a String
Quote:
|
Re: Cutting Folder from a String
It's not always the same string, I was giving an example only.
|
Re: Cutting Folder from a String
Quote:
|
Re: Cutting Folder from a String
Well then as it been said you could iterate bacward because starting from the end you will have less to count.
As a ideea when you hit the first '/' from the end then stop and replace the iterator position with a null terminated char then copyc until you find that null char, or use that position and make a strmid function something like substr. |
| All times are GMT -4. The time now is 19:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.