Add tags

Add tags to the following comment

より単純なスクリプトです。 まず指定された長さの半角スペース列を用意し、次に文字列をpokeで書きこんでいます。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#module
#defcfunc centered_text str _source, int len
    if len <= 0 : return ""
    source = _source

    source_strlen = strlen(source)
    sdim result, len + 1
    memset result, ' ', len
    poke result, limit((len - source_strlen)/2, 0, len/2), strmid(source, limit((source_strlen - len)/2, 0, source_strlen), len)
    return result
#global

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...