Path.GetExtension 获取扩展名

static function GetExtension (path : string) : string

Description描述

Returns the extension component of the specified path string.

返回指定路径字符串的组件扩展名。

The extension returned includes the . character used to separate the extension from the rest of the path.

扩展名返回包含.字符,用于从路径的其余部分分割扩展名。

using System.IO;
using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		Debug.Log(Path.GetExtension("/Some/File/At/foo.extension"));
	}
}
//Remember to import IO to make Path work.
//记得导入IO,使路径正常工作
import System.IO;

function Start () {
	//This will print ".extension".
	//这将打印.extension
	Debug.Log(Path.GetExtension("/Some/File/At/foo.extension"));
}
Page last updated: 2011-3-11