473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

string manipulation

How do I retrieve part of a string "Car\Sports\mama.fla"

from:

"C:\My Documents\My Pictures\Car\Sports\mama.fla"
using asp.net 2.0 with c#.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
Feb 6 '07 #1
4 1680
"Eugene Anthony" <so***********@yahoo.comwrote in message
news:en**************@TK2MSFTNGP04.phx.gbl...
How do I retrieve part of a string "Car\Sports\mama.fla"

from:

"C:\My Documents\My Pictures\Car\Sports\mama.fla"

using asp.net 2.0 with c#.
Will you always want to know "show me the relative path from the My Pictures
folder"...?
Feb 6 '07 #2
Hi,
You need to first find the postion of the character which is constant for
you, like the folder name Car.....

then you can extract the substring from the main string starting from that
position to the end of the string......e.g:-

string str = "C:\\My Documents\\My Pictures\\Car\\Sports\\mama.fla";
Response.Write(str.Remove(str.IndexOf("Car"), str.Length));

Rgds,
Bhaskar

"Eugene Anthony" <so***********@yahoo.comwrote in message
news:en**************@TK2MSFTNGP04.phx.gbl...
How do I retrieve part of a string "Car\Sports\mama.fla"

from:

"C:\My Documents\My Pictures\Car\Sports\mama.fla"
using asp.net 2.0 with c#.
Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***

Feb 6 '07 #3
This will be fixed:

"C:\My Documents\My Pictures\"

An this part will change:

Car\Sports\mama.fla"

Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
Feb 6 '07 #4
"Eugene Anthony" <so***********@yahoo.comwrote in message
news:uh**************@TK2MSFTNGP05.phx.gbl...
This will be fixed:

"C:\My Documents\My Pictures\"

An this part will change:

Car\Sports\mama.fla"
string strFullPath = @"C:\My Documents\My Pictures\Car\Sports\mama.fla";
string strTrimPath = strFullPath.Replace("C:\\My Documents\\My Pictures\\",
String.Empty);
Feb 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2263
by: Dim | last post by:
I found that C# has some buggy ways to process string across methods. I have a class with on global string var and a method where i add / remove from this string Consider it a buffer... with some...
32
14761
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
29
4274
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
4
3470
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if...
10
1753
by: micklee74 | last post by:
hi if i have a some lines like this a ) "here is first string" b ) "here is string2" c ) "here is string3" When i specify i only want to print the lines that contains "string" ie the first...
5
7456
by: Niyazi | last post by:
Hi, Does anyone knows any good code for string manipulation similar to RegularExpresion? I might get a value as string in a different format. Example: 20/02/2006 or 20,02,2006 or ...
3
1545
by: crprajan | last post by:
String Manipulation: Given a string like “This is a string”, I want to remove all single characters( alphabets and numerals) like (a, b, 1, 2, .. ) . So the output of the string will be “This is...
7
2085
Frinavale
by: Frinavale | last post by:
I currently have a .NET application that has an object which passes a string (a connection string) as a parameter to another object that does database manipulation. This string isn't stored...
3
3539
by: frankeljw | last post by:
I have 2 Java strings 1st String is a series of names, colons, and numbers ie) Name1:13:Name2:4526:Name3:789:Name4:3729:Name5:6:Name6:44 2nd String is a name ie) Name2 I need to get the...
22
2568
by: mann_mathann | last post by:
can anyone tell me a solution: i cannot use the features in standard c++ string classgh i included the string.h file but still its not working.
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7008
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4688
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.