UILabel.GetUrlAtCharacterIndex C# (CSharp) Méthode

GetUrlAtCharacterIndex() public méthode

Retrieve the URL right under the specified character index.
public GetUrlAtCharacterIndex ( int characterIndex ) : string
characterIndex int
Résultat string
	public string GetUrlAtCharacterIndex (int characterIndex)
	{
		if (characterIndex != -1 && characterIndex < mText.Length)
		{
			int linkStart = mText.LastIndexOf("[url=", characterIndex, characterIndex);

			if (linkStart != -1)
			{
				linkStart += 5;
				int linkEnd = mText.IndexOf("]", linkStart);

				if (linkEnd != -1)
				{
					int closingStatement = mText.IndexOf("[/url]", linkEnd);
					if (closingStatement == -1 || closingStatement >= characterIndex)
						return mText.Substring(linkStart, linkEnd - linkStart);
				}
			}
		}
		return null;
	}

Usage Example

    static int GetUrlAtCharacterIndex(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        UILabel obj  = (UILabel)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UILabel");
        int     arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
        string  o    = obj.GetUrlAtCharacterIndex(arg0);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
All Usage Examples Of UILabel::GetUrlAtCharacterIndex