ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:getcolorcodeat

Table of Contents

GetColorCodeAt

str GetColorCodeAt(str s, int i)

Description

Returns the full text of the colorcode at position i. If there is no colorcode, returns an empty string. Shorthand for StrSlice(s, i, SkipColorCodeAt(s, i));

Examples

Print all colorcodes in a string:

int len = StrLen(s);
int i = 0;
while (i < len)
{
    str cc = GetColorCodeAt(s, i);
    if (!StrIsEmpty(cc))
        print(s:StrSlice(cc, 1, StrLen(cc)));
    i += StrLen(cc);
}
functions/getcolorcodeat.txt · Last modified: 2017/07/09 17:56 by korshun