替换“%20”在Uri.AbsoluteUri [英] Replacing "%20" in Uri.AbsoluteUri

查看:64
本文介绍了替换“%20”在Uri.AbsoluteUri的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 


我正在使用C#.net 4.5.2中的Azure存储SDK来处理Microsoft.WindowsAzure.Storage.blob类型的对象。 ICloudBlob并使用名为&AbsoluteUri的属性之一。  


如果此属性包含空格,则将其作为(例如)"My%20Database%20UAT"返回,而实际上我想要"我的数据库UAT"。代替。   


我想要一个干净的方法来替换"%20""使用单个空格而不使用.Replace()。  也只是用一个空格替换是错误的,因为可能有两个(或更多)空格。



我看过一个数字例如,调用方法  UnescapeDataString(),但这不适用于AbsoluteUri。 


背景:这是一个控制台应用程序,用于处理Azure blob存储中的SQL数据库备份文件容器。  特定类型"Page Blob"在这个例子中。


 这可能会解释得更好。 


解决方案

你试过  blob.Uri.Tostring() 


Hi, 

I'm using the Azure storage SDK in C# .net 4.5.2 to process an object of type Microsoft.WindowsAzure.Storage.blob.ICloudBlob and using one of the properties called AbsoluteUri.  

Where this property contains spaces then it's returned as (for example) as "My%20Database%20UAT", when in fact I would like to have "My Database UAT" instead.   

I would like a clean way to replace the "%20" with a single space without resorting to .Replace().  Also just replacing with a single space is wrong because there may well be two (or more) spaces.

I have seen a number of example where a method UnescapeDataString() is called, however this is not available to AbsoluteUri. 

Background: This is a console application which processes SQL database backup files in Azure blob storage containers.  The specific type "Page Blob" in this example.

 This might explain a bit better. 

解决方案

Have you tried blob.Uri.Tostring() 


这篇关于替换“%20”在Uri.AbsoluteUri的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆