Created
February 18, 2015 01:39
-
-
Save enpel/1958842c942483dcc0c5 to your computer and use it in GitHub Desktop.
NGUIのUIPopupList のイベントで取得する時の文字列に入ってる改行とかをなくすためのStringの拡張
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class SampleHogePopupList : MonoBehaviour | |
{ | |
string keyword = "hogege"; | |
public void PopupListOnChange () { | |
string key = UIPopupList.current.value.DeleteInvisibleCharacter(); | |
if (keyword == key) | |
Debug.Log("やったぜ"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public static class StringExtensions | |
{ | |
public static string DeleteInvisibleCharacter(this string s) | |
{ | |
return s.Replace("\r", "").Replace("\n", "").Replace("\t", "").Replace(" ", ""); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment