WWW.EscapeURL 编码网址


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

Parameters参数

  • s
    A string to be escaped.
          一个字符串进行转义,也就是用来编码的字符串
  • e
    The encoding to use when converting characters to a character code.
          当转换字符到一个字符代码时,使用编码encoding,也就是编码的字符集

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.

  • C#

  • JavaScript

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"));


,