strPrompt Function

Appends to a string the specified number of period characters followed by a colon and space character.


str strPrompt(str _string, _int len)

Parameter

Description

_string

The original string.

_len

The desired final length of the string.

A string that looks like a prompt for user input.

In atypical cases where the value of the _len parameter is only slightly larger than the length of the original string, top precedence is given to adding the trailing space. The next precedence is given to the colon. The lowest precedence is given to the periods. Negative values for the _len parameter return the input string appended with a trailing space.

  • strPrompt(“ab”,-1); //Returns “ab “.

  • strPrompt(“ab”,3); //Returns “ab “.

  • strPrompt(“ab”,4); //Returns “ab: “.

  • strPrompt(“ab”,5); //Returns “ab.: “.

  • strPrompt(“ab”,6); //Returns “ab..: “.

static void JobStrPromptDemo(Args _args)
{
    // Printed string is "[abc..: ]"
    print "[", strPrompt("abc", 7), "]";
    pause;
}

Community Additions

ADD
Show: