AudioAsset
Ease
FastString
FontAsset
NineSlice
PackedSprite
PackedSpriteID
RB
   HardwareSettings
   IRetroBlitGame
RBAsset
Rect2i
ShaderAsset
SoundReference
SpriteGrid
SpriteSheetAsset
TMXMapAsset
   TMXLayer
   TMXLayerLoadState
   TMXObject
   TMXObjectGroup
   TMXProperties
Vector2i

FastString.LastIndexOf

Method

public int LastIndexOf(string str)
public int LastIndexOf(FastString str)
public int LastIndexOf(string str, int startIndex)
public int LastIndexOf(FastString str, int startIndex)
public int LastIndexOf(char c)
public int LastIndexOf(char c, int startIndex)

Parameters

str string String to find
startIndex int Index to start searching at
c char Character to find

Returns

int

Index of the string, or -1 if not found

Description

Return last index of given string. startIndex can be specified to start search from the given index.

Example

// Allocate a FastString that can hold up to 256 characters
FastString fstr = new FastString(256);

void Update() {
    fstr.Set("retroblit is retro");
    Debug.Log(fstr.LastIndexOf("retro")); // index 13
    Debug.Log(fstr.LastIndexOf("retro"), 8); // index 0
    Debug.Log(fstr.LastIndexOf("missing"), 1); // index -1
}

See Also

FastString.IndexOf