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

FastString.Truncate

Method

public FastString Truncate(int truncatedLength)

Parameters

truncatedLength int New truncated length

Returns

FastString

The same instance of FastString

Description

Truncates the string to the given length.

The FastString.Truncate method returns this, which allows it to be chained with other methods such as FastString.Append.

Example

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

void Render() {
    // Prints "RetroBlit"
    fstr.Set("RetroBlit");
    RB.Print(new Vector2i(00), Color.white, fstr);

    // Prints "Retro"
    fstr.Truncate(5);
    RB.Print(new Vector2i(020), Color.white, fstr);
}

See Also

FastString.Clear
FastString.Append

See Docs

Features - Avoid GC with Fast String