Architecture Modeler Internal Language Functions Description

string.substr(pos1,pos2)

string.substr(pos1,pos2) – returns a substring, derived from pos1 to pos2 of string.

Examples:

expressionid.0.substr ( 5, 4 )
expressionid.0.substr(expressionid.0.length() - 5, 4 )
expressionid.0.substr( 4 , expressionid.0.length() - 5 )
expressionid.0.substr(expressionid.0.length() - 9 , expressionid.0.length() - 5 )
expressionid.sourcefilename.substr(1,5)
expressionid.sourcefilename.substr(expressionid.0.sourcefilename.length() - 11 , 3 )
expressionid.sourcefilename.substr( 0, expressionid.0.sourcefilename.length() - 4 )
expressionid.sourcefilename.substr(expressionid.0.sourcefilename.length() – 15 ) 

string1.append(string2)

string1.append(string2) - appends string2 to string1.

Examples:

expressionid.0.append( \"._abcd_\" )
expressionid.0.append(expressionid.0 )
expressionid.0.append(expressionid.0.sourcefilename )
expressionid.sourcefilename.append(  \"_001\"  )
expressionid.sourcefilename.append(  expressionid.0  )

string.length()

string.length() - returns the length of the string.

Examples:

expressionid.sourcefilename.length()
expressionid.sourcefilename.length()-3
expressionid.sourcefilename.length()+13
expressionid.sourcefilename.length( )

concat(string1, string2)

concat(string1, string2) – returns concatenation of string1 and string2

Examples:

concat(\"ab_\", \"cd__\" )
concat( expressionid.0,expressionid.0)
concat( expressionid.0, \"_test_\" )
concat( \"_test_\" , expressionid.0 )
concat( expressionid.sourcefilename , expressionid.0 )
concat(expressionid.0, expressionid.sourcefilename )
concat(expressionid.sourcefilename.substr(0, expressionid.sourcefilename.length()-3), expressionid.0)
concat(expressionid.sourcefilename.append( \"...\"), expressionid.0)
concat(expressionid.sourcefilename, \"_abc_\" )
concat( \"_abc_\" , expressionid.sourcefilename )
concat( \"_abc_\" , concat( \"_efg_\" , \"_xy_z_\") )
concat( concat( \"_efg_\" , \"_xy_z_\"), \"_abc_\" )
concat( concat( \"_efg_\" , concat(\"_val1_\", \"_val2_\")) , \"_abc_\" )
concat( concat(expressionid.sourcefilename.append( \"...\") , \"_val_\" ) , expressionid.0)

replace(string1,string2,string3)

replace(string1,string2,string3) – replaces all occurrences of string2 in string1 with string3.

Examples:

replace( \"ab_\", \"_\", \"__\" ) // equals “ab__”
replace( \"ab_\", \"ab\", \"cd\" ) // equals “cd_”
replace(expressionid.sourcefilename.substr(1,5), \"a\", \"b\" ) 
// replaces ‘a’ with ‘b’ in the first 5 letters of expressionid.sourcefilename
replace(expressionid.sourcefilename, '/' . '\' ) // converts backslashes to slashes
	 

getpath(string)

getpath(string) – returns a string, trimmed starting from the last occurrence of ‘\’ or ‘/’ . Returns the absolute path as string before the last occurrence of \ or /.

Examples:

getpath(“c:\path1\path2\filename.ext”) // returns c:\path1\path2\
getpath(“..\path1\path2\filename.ext”) // returns ..\path1\path2\
getpath(expressionid.sourcefilename) // returns the path of the sourcefilename

getfilename(string)

getfilename(string) – .returns the filenames in paths as a string after the last occurrence of the \ or /?

Examples:

getfilename (“c:\path1\path2\filename.ext”) // returns filename.ext
getfilename (“..\path1\path2\filename.ext”) // returns filename.ext
getfilename (expressionid.sourcefilename) // returns filename of the sourcefilename
 

unifypath(string)

unifypath(string) – returns transformed string by the following rules:

  • Converting all backslashes to slashes.

    Example:

    /path1/path2 is transformed into \path1\path2

  • Removing duplicate slashes.

    Example:

    //path1/\path2 is transformed into \path1\path2

  • Removing references to current directory

    Example:

    \.\path1/.\path2 is transformed into \path1\path2

  • Removing references to parent directory (if not in the beginning) examples

    Examples:

    \path1\..\path2 is transformed into \path2

    ..\path1\..\path2\path3 is transformed into ..\path2\path3