WWW.EscapeURL 编码网址

static function EscapeURL (s : string, e : Encoding = System.Text.Encoding.UTF8) : string

Parameters参数

Returns

string - A new string with all illegal characters replaced with %xx where xx is the hexadecimal code for the character code.

返回string类型,一个新的字符串,用%xx替换所有非法字符,其中xx是十六进制的字符代码。

Description描述

Encodes string into an URL-friendly format.

字符串编码成一个URL的格式。

Replaces illegal characters in s with the correct URL escaped code. Useful when building web page parameters.

使用正确的URL替换非法转义代码,在建立网页时是非常有用的参数。

参考:WWW.UnEscapeURL.

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		print(WWW.EscapeURL("Testing 1,2,3"));
	}
}
// This will print the string "Testing%201%2C2%2C3" to the console
//这将打印字符串"Testing%201%2C2%2C3"到控制台
print(WWW.EscapeURL("Testing 1,2,3"));
Page last updated: 2011-4-25