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

FastString.IndexOf

Method

public int IndexOf(string str, int startIndex = 0)
public int IndexOf(FastString str, int startIndex = 0)
public int IndexOf(char c, int startIndex = 0)

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 first 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.IndexOf("retro")); // index 0
    Debug.Log(fstr.IndexOf("retro"), 1); // index 13
    Debug.Log(fstr.IndexOf("missing"), 1); // index -1
}

See Also

FastString.LastIndexOf