Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added the SplitPathFilename subroutine and unit tests
[xestiacalendar/.git] / source / common / text.cpp
index f6549d2..fff4c83 100644 (file)
@@ -266,4 +266,42 @@ bool IntToHex(int *Number, std::string *HexString, int HexFill){
        
        return true;
        
+}
+
+void SplitPathFilename(string *CalendarEntryHREF, string *EntryURIPath, 
+       string *EntryFilename){
+       
+       // Look for the last forward slash.
+               
+       int LastForwardSlash = -1;
+       int CharSeek = 0;
+       string StringIterChar = "";
+               
+       for (string::iterator StringIter = CalendarEntryHREF->begin();
+               StringIter != CalendarEntryHREF->end(); StringIter++){
+               
+               StringIterChar = *StringIter;
+                       
+               if (StringIterChar == "/"){
+                       LastForwardSlash = CharSeek;
+               }
+               
+               CharSeek++;
+                       
+       }
+       
+       if (LastForwardSlash == -1){
+               
+               return;
+               
+       }
+       
+       // Get the string before the last hash for the path.
+       
+       (*EntryURIPath) = CalendarEntryHREF->substr(0, (LastForwardSlash + 1));
+       
+       // Get the string after the last hash for the filename.
+       
+       (*EntryFilename) = CalendarEntryHREF->substr((LastForwardSlash + 1));
+               
 }
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy