Text Functions (AutoCAD Mechanical Toolset)

The position of characters in the text indexes beginning at zero. That means the last character in the text has the index equal to (LEN(text)-1).

To use a literal text as an argument of a function, enclose the text in quotes (“ string_constant ”).

FIND(find_text, within_text, start_index)

Locates the argument find_text in the argument within_text and returns the starting position of find_text in within_text. The start_index argument specifies the character at which the search starts. If find_text is not found, the function returns -1.

LEFT(text, num_chars)

Returns the first num_chars characters of the argument text.

MID( text, start_at, num_chars)

Returns num_chars characters from the argument text, starting from the position start_at.

RIGHT( text, num_chars)

Returns the last num_chars characters of the argument text.

LEN(text)

Returns the number of characters (length) of the argument text.

LOWER(text)

Returns the argument text, converted completely to lower case.

UPPER(text)

Returns the argument text, converted completely to upper case letters.

REPLACE(original_text,start_position,num_chars,inserted_string)

Returns a text string created by way of replacing num_chars characters in original_text, with inserted_string, starting at start_postion.

TRIM(text)

Returns a text string with all leading and trailing spaces from the argument text removed.