Delphi:用于将字符串转换为可用于url的字符串的函数 [英] Delphi: function to convert a string in a url-ready one

查看:200
本文介绍了Delphi:用于将字符串转换为可用于url的字符串的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

标准的URL编码函数?

我需要转换Delphi字符串(例如 TEdit.Caption )放在具有 URL功能的字符串中。

I need to transofrm a Delphi string (like TEdit.Caption) in a "url capable" string.

我需要这样做,因为我将打开google像在 TEdit 中以编程方式映射地图,我写了悉尼高街

I need this because I will open google maps programmatically like in TEdit I write "High Street, Sydney"

,然后我想打开浏览器在 maps.google.com/maps?q=High+Street+Sidney

and then i would like to open the browser at maps.google.com/maps?q=High+Street+Sidney

是否有现成的功能可以

推荐答案

您可以将Indy中的IdURI单元添加到use子句中,并使用TIdURI.URLEncode。 ()编码URL的方法,以及TIdURI.Decode()将编码的URL解码为普通字符串。

You can add IdURI unit from Indy to your uses clause, and use TIdURI.URLEncode() method to encode a URL, and TIdURI.Decode() to decode an encoded URL to a normal string.

这篇关于Delphi:用于将字符串转换为可用于url的字符串的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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