隱藏目錄

Functions for Variables

In creating variables, use string and arithmetic functions to configure their values. You can add these functions by clicking right arrow next to Value fields in dialog boxes.

String Functions

Function

Left

Description

Returns the leftmost specified number of characters from a specified string.

Syntax

Left(<string>,<number>)

Arguments

<string> - The character string

<number> - The number of characters to be returned

Example

Left(ProjectAA,7)

Returns "Project"

Function

Right

Description

Returns the rightmost specified number of characters from a specified string.

Syntax

Right(<string>,<number>)

Arguments

<string> - The character string

<number> - The number of characters to be returned

Example

Right(ProjectAA,2)

Returns "AA"

Function

Mid

Description

Returns a substring from a specified string (starting at a specified position).

Syntax

Mid(<string>,<startpos>,<number>)

Arguments

<string> - The character string

<startpos> - The number of the starting position. The first character is position 0.

<number> - The number of characters to be returned

Example

Mid(ProjectAA,2,2)

Returns "je"

Function

Length

Description

Returns the length of a specified string.

Syntax

Length(<string>)

Arguments

<string> - The character string

Example

Length(ProjectAA)

Returns 9

Function

Reverse

Description

Returns the reverse of a specified string.

Syntax

Reverse(<string>)

Arguments

<string> - The character string

Example

Reverse(stockholm)

Returns "mlohkcots"

Function

Find

Description

Searches a specified string for the first match of a character or substring. Returns the position where the character or substring is found.

The first position in the character string is 0.

Syntax

Find(<string>,<substring>)

Arguments

<string> - The character string

<substring> - The character substring for which to search

Example

Find(abc,b)

Returns 1

Function

ReverseFind

Description

Searches a specified string for the last match of a character. Returns the position where the last occurrence of the character or substring is found.

The first position in the character string is 0.

Syntax

Find(<string>,<substring>)

Arguments

<string> - The character string

<substring> - The character substring for which to search

Example

ReverseFind(abcabc,b)

Returns 4

Function

CurrentTime

Description

Returns the current date or time in a specified format

Syntax

CurrentTime(%%Y-%%m-%%d %%H:%%M:%%S)

Arguments

%%a - Abbreviated weekday name

%%A - Full weekday name

%%b - Abbreviated month name

%%B - Full month name

%%c - Date and time representation appropriate for locale

%%d - Day of month as decimal number (01 - 31)

%%H - Hour in 24-hour format (00 - 23)

%%I - Hour in 12-hour format (01 - 12)

%%j - Day of year as decimal number (001 - 366)

%%m - Month as decimal number (01 - 12)

%%M - Minutes as decimal number (00 - 59)

%%p - Current locale's A.M./P.M. indicator for 12-hour clock

%%S - Seconds as decimal number (00 - 59)

%%U - Week of year as decimal number, with Sunday as first day of week (00 - 53)

%%w - Weekday as decimal number (0 - 6; Sunday is 0)

%%W - Week of year as decimal number, with Monday as first day of week (00 - 53)

%%x - Date representation for current locale

%%X - Time representation for current locale

%%y - Year without century, as decimal number (00 - 99)

%%Y - Year with century, as decimal number

%%z,%%Z - Either the time zone name or abbreviation, depending on registry settings; no characters if time zone is unknown

%%%% - Percent sign

Examples

CurrentTime(%%y%%m%%d)

Returns "050113"

CurrentTime (%%H:%%M)

Returns "09:53"

Arithmetic Functions

Function

Add

Description

Returns the sum of the two specified numbers.

Syntax

Add(<term1>,<term2>)

Arguments

<term1> - First term

<term2> - Second term

Example

Add(2,3)

Returns 5

Function

Sub

Description

Returns the difference between the two specified numbers.

Syntax

Sub(<term1>,<term2>)

Arguments

<term1> - First term

<term2> - Second term (amount to be subtracted)

Example

Sub(3,2)

Returns 1



提供對此主題的意見反應

SOLIDWORKS 歡迎您提供有關於文件呈現方式、正確性、及完整性的意見反應。請使用下方的表格直接將您對此主題的意見與建議傳送給我們的文件團隊。文件團隊並無法回答關於技術支援的問題。按一下此處來獲得關於技術支援的資訊

* 必要的

 
*電子郵件:  
主旨:   說明主題的意見反應
頁面:   Functions for Variables
*意見:  
*   我承認已閱讀且僅此接受隱私權政策,Dassault Systèmes 將遵循此政策之規定使用我的個人資料

列印主題

選擇要列印的內容範圍:

x

偵測到您使用的瀏覽器版本是舊於 Internet Explorer 7。要獲得最佳的顯示,建議您升級瀏覽器到 Internet Explorer 7 或更新的版本。

 不要再次顯示此訊息
x

Web 式說明內容版本:SOLIDWORKS PDM 2014 SP05

要從 SOLIDWORKS 中停用 Web 式的說明並改用本機說明,請按一下說明 > 使用 SOLIDWORKS Web 式說明

要報告在 Web 式說明介面及搜尋中遇到的問題,請聯絡您當地的技術支援代表。要針對個別說明主題提供意見反應,請使用個別主題頁面中的「提供對此主題的意見反應」連結。