Thread View: borland.public.cppbuilder.nativeapi
10 messages
10 total messages
Started by Safari
Fri, 28 Mar 2003 16:58
My Questions.
Author: Safari
Date: Fri, 28 Mar 2003 16:58
Date: Fri, 28 Mar 2003 16:58
13 lines
1292 bytes
1292 bytes
Hello to all,
2 Questions,
1. How can i extract my path without my drive?
Example: My Path is: "D:\Program Files\CBuilder\Projects"
and i want: "Program Files\CBuilder\Projects"
2. I want to have many characters of a string. how can i do this?
Exmple: Copy(MyString, ???_Start, ???_Length));
Thanks,
Safari.
Re: My Questions.
Author: Stephane Baillargeon
Date: Fri, 28 Mar 2003 20:02
Date: Fri, 28 Mar 2003 20:02
22 lines
1570 bytes
1570 bytes
AnsiString strString = "D:\MyPath"; AnsiString strResult = strString.SubString(3,strString.Length()); SubString(int index, int length) "Safari" <Safari@alloymail.com> wrote in message news:3E847F41.5020409@alloymail.com... > > Hello to all, > 2 Questions, > > 1. How can i extract my path without my drive? > Example: My Path is: "D:\Program Files\CBuilder\Projects" > and i want: "Program Files\CBuilder\Projects" > > 2. I want to have many characters of a string. how can i do this? > Exmple: Copy(MyString, ???_Start, ???_Length)); > > Thanks, > Safari. >
Re: My Questions.
Author: Michel Leunen
Date: Fri, 28 Mar 2003 20:02
Date: Fri, 28 Mar 2003 20:02
21 lines
1633 bytes
1633 bytes
Safari wrote: > 1. How can i extract my path without my drive? > Example: My Path is: "D:\Program Files\CBuilder\Projects" > and i want: "Program Files\CBuilder\Projects" ExtractFilePath() > > 2. I want to have many characters of a string. how can i do this? > Exmple: Copy(MyString, ???_Start, ???_Length)); Sorry, I don't understand what you mean. Michel -- ---------------------------------------- Michel Leunen mailto:michel@leunen.com http://www.leunen.com/cbuilder/ ----------------------------------------
Re: My Questions.
Author: Michel Leunen
Date: Fri, 28 Mar 2003 20:08
Date: Fri, 28 Mar 2003 20:08
20 lines
1599 bytes
1599 bytes
Michel Leunen wrote: > Safari wrote: > >> 1. How can i extract my path without my drive? >> Example: My Path is: "D:\Program Files\CBuilder\Projects" >> and i want: "Program Files\CBuilder\Projects" > > > ExtractFilePath() Oops, sorry, I've not read your question correctly. Use the method given by Stephane. Michel -- ---------------------------------------- Michel Leunen mailto:michel@leunen.com http://www.leunen.com/cbuilder/ ----------------------------------------
Re: My Questions.
Author: Remy Lebeau (TeamB)
Date: Fri, 28 Mar 2003 20:36
Date: Fri, 28 Mar 2003 20:36
25 lines
1623 bytes
1623 bytes
"Safari" <Safari@alloymail.com> wrote in message news:3E847F41.5020409@alloymail.com... > 1. How can i extract my path without my drive? > Example: My Path is: "D:\Program Files\CBuilder\Projects" > and i want: "Program Files\CBuilder\Projects" ExtractFilePath() and ExtractFileDrive(), then stip off the number of characters returned by ExtractFileDrive(). > 2. I want to have many characters of a string. how can i do this? > Exmple: Copy(MyString, ???_Start, ???_Length)); I don't understand what you're asking. Gambit --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Re: My Questions.
Author: Safari
Date: Fri, 28 Mar 2003 22:26
Date: Fri, 28 Mar 2003 22:26
31 lines
1977 bytes
1977 bytes
Thanks Remy, 1. MyPath = "D:\Program Files\CBuilder\Projects\Project1.exe" ExtractFilePath() = "D:\Program Files\CBuilder\Projects\" ExtractFileName() = "Project1.exe" ExtractFileDrive() = "D:" But i want "Program Files\CBuilder\Projects" 2. My String is: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" My meaning is: Copy(MyString, ???_Start, ???_Length); if ???_Start = 10 and ???_Length = 10 then My Result is: "JKLMNOPQRS" :-) Thanks again, Safari "Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message news:3e84aff5$1@newsgroups.borland.com... | | ExtractFilePath() and ExtractFileDrive(), then stip off the number of | characters returned by ExtractFileDrive(). | | > 2. I want to have many characters of a string. how can i do this? | > Exmple: Copy(MyString, ???_Start, ???_Length)); | | I don't understand what you're asking. | | Gambit | | Outgoing mail is certified Virus Free. | Checked by AVG anti-virus system (http://www.grisoft.com). | Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Re: My Questions.
Author: Safari
Date: Fri, 28 Mar 2003 22:28
Date: Fri, 28 Mar 2003 22:28
9 lines
1234 bytes
1234 bytes
Thanks Stephane, Safari "Stephane Baillargeon" <sbaillargeon@microids.com> wrote in message news:3e84aa6e$2@newsgroups.borland.com... | AnsiString strString = "D:\MyPath"; | AnsiString strResult = strString.SubString(3,strString.Length()); | | SubString(int index, int length)
Re: My Questions.
Author: Safari
Date: Fri, 28 Mar 2003 22:29
Date: Fri, 28 Mar 2003 22:29
15 lines
1328 bytes
1328 bytes
Thanks Michel, I do'nt have ExtractFileName(), ExtractFilePath() and ExtractFileDrive(). Thanks again, Safari "Michel Leunen" <mleu@skynet.be> wrote in message news:3e84aa6e@newsgroups.borland.com... | Safari wrote: | | > 1. How can i extract my path without my drive? | > Example: My Path is: "D:\Program Files\CBuilder\Projects" | > and i want: "Program Files\CBuilder\Projects" | | ExtractFilePath()
Re: My Questions.
Author: Remy Lebeau (TeamB)
Date: Fri, 28 Mar 2003 23:15
Date: Fri, 28 Mar 2003 23:15
16 lines
1379 bytes
1379 bytes
They are VCL functions Gambit "Safari" <Safari@alloymail.com> wrote in message news:3e84ccfb@newsgroups.borland.com... > I do'nt have ExtractFileName(), ExtractFilePath() and ExtractFileDrive(). --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Re: My Questions.
Author: Remy Lebeau (TeamB)
Date: Fri, 28 Mar 2003 23:22
Date: Fri, 28 Mar 2003 23:22
44 lines
2395 bytes
2395 bytes
"Safari" <Safari@alloymail.com> wrote in message
news:3e84cc23@newsgroups.borland.com...
> 1. MyPath = "D:\Program Files\CBuilder\Projects\Project1.exe"
> ExtractFilePath() = "D:\Program Files\CBuilder\Projects\"
> ExtractFileName() = "Project1.exe"
> ExtractFileDrive() = "D:"
> But i want "Program Files\CBuilder\Projects"
As suggested earlier, you would strip off the drive portion returned by
ExtractFileDrive():
AnsiString FilePath = ExtractFilePath(MyPath);
AnsiString FileDrive = ExtractFileDrive(FilePath);
if( !FileDrive.IsEmpty() )
FilePath.Delete(1, FileDrive.Length()+1);
Another possibility, if you can guarantee ahead of time that you're not
using UNC paths, is to use ProcessPath() instead:
char Drive;
AnsiString DirPart;
AnsiString FilePart;
ProcessPath(MyPath, Drive, DirPart, FilePart);
> 2. My String is: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
> My meaning is: Copy(MyString, ???_Start, ???_Length);
> if ???_Start = 10 and ???_Length = 10 then
> My Result is: "JKLMNOPQRS" :-)
Use SubString():
AnsiString MyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
AnsiString MySubStr = MyStr.SubString(10, 10);
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/03
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads