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

FastString.Append

Method

public FastString Append(string str, int startIndex = 0, int len = int.MaxValue)
public FastString Append(FastString str, int startIndex = 0, int len = int.MaxValue)
public FastString Append(char c)
public FastString Append(long val, uint minDigits = 0, uint flags = 0)
public FastString Append(ulong val, uint minDigits = 0, uint flags = 0)
public FastString Append(int val, uint minDigits = 0, uint flags = 0)
public FastString Append(uint val, uint minDigits = 0, uint flags = 0)
public FastString Append(short val, uint minDigits = 0, uint flags = 0)
public FastString Append(ushort val, uint minDigits = 0, uint flags = 0)
public FastString Append(sbyte val, uint minDigits = 0, uint flags = 0)
public FastString Append(byte val, uint minDigits = 0, uint flags = 0)
public FastString Append(float val, uint precision = PRECISION_UNDEFINED)
public FastString Append(double val, uint precision = PRECISION_UNDEFINED)
public FastString Append(Vector2i val)
public FastString Append(Vector2 val)
public FastString Append(Vector3 val)
public FastString Append(Vector4 val)
public FastString Append(Rect2i val)
public FastString Append(Rect val)
public FastString Append(Color32 val, uint flags = 0)
public FastString Append(Color val, uint flags = 0)

Parameters

str string Source string
startIndex int Start index, default 0
len int Length, defaults to end of string
c char Char
val long Value
minDigits uint Minimum digits
flags uint One of FastString.FILL_SPACES or FastString.FILL_ZEROS
precision uint Decimal precision

Returns

FastString

The same instance of FastString

Description

Appends a value to the string. Many different kinds of values can be appended, including strings, numbers, vectors, rects, and colors.

When appending a string or another FastString a substring can be specified using the startIndex and len parameters.

When appending numbers, minDigits specify the minimum amount of digits that should be appended, with padding added as necessary. Padding type is specified with flags, which can be either FastString.FILL_SPACES, or FastString.FILL_ZEROS.

When appending floating point numbers the decimal point precision can be specified with precision, the default value is FastString.PRECISION_UNDEFINED for maximum precision.

The FastString.Append method returns this, which allows multiple append calls to be chained together.

The string can be cleared with FastString.Clear.

Example

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

void Render() {
    fstr.Set("Hello there ").Append(playerName).Append("!");
    RB.Print(new Vector2i(00), Color.white, fstr);
}

See Also

FastString.Clear
FastString.Truncate

See Docs

Features - Avoid GC with Fast String