Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Path.Combine equivalent for URLs?

Reply
Thread Tools

Path.Combine equivalent for URLs?

 
 
Brian Vallelunga
Guest
Posts: n/a
 
      04-09-2007
Is there a way to easily combine two parts of a url? Something like
Path.Combine for system files would be perfect.

So if I have:

string s1 = "http://mydomain.com/"
string s2 = "/hello/image.jpg"

I would want the combination to not have the double '//' in the middle
that a normal concatenation would give.

 
Reply With Quote
 
 
 
 
John Timney \(MVP\)
Guest
Posts: n/a
 
      04-09-2007
You could just trim the second string and join them together

string s1 = "http://mydomain.com/";
string s2 = "/hello/image.jpg";
string s3 = s2.Remove(0,1);
string s4 = s1 += s3;
Label1.Text = s4;

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog


"Brian Vallelunga" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Is there a way to easily combine two parts of a url? Something like
> Path.Combine for system files would be perfect.
>
> So if I have:
>
> string s1 = "http://mydomain.com/"
> string s2 = "/hello/image.jpg"
>
> I would want the combination to not have the double '//' in the middle
> that a normal concatenation would give.
>



 
Reply With Quote
 
 
 
 
Brian Vallelunga
Guest
Posts: n/a
 
      04-09-2007
On Apr 9, 5:11 pm, "John Timney \(MVP\)" <(E-Mail Removed)>
wrote:
> You could just trim the second string and join them together
>
> string s1 = "http://mydomain.com/";
> string s2 = "/hello/image.jpg";
> string s3 = s2.Remove(0,1);
> string s4 = s1 += s3;
> Label1.Text = s4;
>
> Regards
>
> John Timney (MVP)http://www.johntimney.comhttp://www.johntimney.com/blog


That's essentially what I'm doing now, but I was hoping for something
more robust, that could accomodate other people putting in various
strings.

 
Reply With Quote
 
John Timney \(MVP\)
Guest
Posts: n/a
 
      04-10-2007
I don't believe theres anything that intelligent really. To be honest its
not worth worrying about as // is valid in an http path.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog


"Brian Vallelunga" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> On Apr 9, 5:11 pm, "John Timney \(MVP\)" <(E-Mail Removed)>
> wrote:
>> You could just trim the second string and join them together
>>
>> string s1 = "http://mydomain.com/";
>> string s2 = "/hello/image.jpg";
>> string s3 = s2.Remove(0,1);
>> string s4 = s1 += s3;
>> Label1.Text = s4;
>>
>> Regards
>>
>> John Timney (MVP)http://www.johntimney.comhttp://www.johntimney.com/blog

>
> That's essentially what I'm doing now, but I was hoping for something
> more robust, that could accomodate other people putting in various
> strings.
>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning:Xst:382 - Register A is equivalent to B mag VHDL 1 05-19-2005 05:10 PM
instancename of current entity/architecture -- equivalent to C++ this??? Eric Peers VHDL 2 11-18-2004 05:23 PM
VHDL equivalent of verilog trireg Sanjeev VHDL 4 07-23-2004 09:55 AM
equivalent types in different packages Lolo VHDL 3 09-22-2003 03:23 PM
Re: Image Scanning - TWAIN equivalent Brendan Duffy ASP .Net 0 07-24-2003 08:29 AM



Advertisments