| | |
System.String.LastIndexOf problem
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2007
Posts: 68
Reputation:
Solved Threads: 0
I am writing a program to batch rename files. I am trying to take the file name (which include folders) and remove everything before the last slash.
The problem is that LastIndexOf("\\") always returns -1, even if the string contains a "\".
And the Remove(0, index) doesn't ever remove any characters from the string.
If I were using std::strings, I would just use the findLastNotOf() and erase() functions.
TIA.
The problem is that LastIndexOf("\\") always returns -1, even if the string contains a "\".
And the Remove(0, index) doesn't ever remove any characters from the string.
If I were using std::strings, I would just use the findLastNotOf() and erase() functions.
TIA.
Last edited by toadzky; Mar 28th, 2007 at 4:43 am.
If you're using VC++ then using std::string is not problem !
C++ .NET -> I donno.
Reason why I said sounds like JavaScript is coz I googled the functions you'd posted and all links pointed to some JavaScript or the other.
Coming back to the problem, I'm sorry but without knowing teh function I can't comment. If you've spent enough time on this I suggest just implement your own find_first_of() and erase().
C++ .NET -> I donno.
Reason why I said sounds like JavaScript is coz I googled the functions you'd posted and all links pointed to some JavaScript or the other.
Coming back to the problem, I'm sorry but without knowing teh function I can't comment. If you've spent enough time on this I suggest just implement your own find_first_of() and erase().
![]() |
Similar Threads
- Final GUI JFrame problem with actionlistner method (Java)
- Problem with Client-Server Socket Connection (Java)
- Problem with chars! (C++)
- nokia 6630 audio problem (Java)
- why i have to press "enter" twice before getline can read the string... (C++)
Other Threads in the C++ Forum
- Previous Thread: Help with indenting infile -> outfile paragraph...
- Next Thread: using borland C++
Views: 1585 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





