comstr#

Purpose

String handling functions for the Structural Dynamics Toolbox.

Syntax

See details below

Description

The user interfaces of the Structural Dynamics Toolbox have a number of string handling needs which have been grouped in the comstr function. The appropriate formats and usual place of use are indicated below.

Cam,string istrue=comstr(Cam,'string')#

String comparison. 1 is returned if the first characters of Cam contain the complete 'string'. 0 is returned otherwise. This call is used extensively for command parsing. Note that istrue is output in format double and not logical. See also strncmp.

Cam,string,format [opt,CAM,Cam]=comstr(CAM,'string','format')#

Next string match and parameter extraction. comstr finds the first character where lower(CAM) differs from string. Reads the remaining string using the sscanf specified format. Returns opt the result of sscanf and CAM the remaining characters that could not be read with the given format.

[opt,CAM,Cam]=comstr(CAM,'string','%c') is used to eliminate the matching part of string.

CAM,ind [CAM,Cam] = comstr(CAM,ind)#

Command segmentation with removal of front and tail blanks. The first ind characters of the string command in capitals CAM are eliminated. The front and tail blanks are eliminated. Cam is a lowercase version of CAM. This call to comstr is used in all UI command functions for command segmentation.

-1 opt = comstr(CAM,[-1 default])#

Option parameter evaluation. The string CAM is evaluated for numerical values which are output in the row vector opt. If a set of default values default is given any unspecified value in opt will be set to the default.

-3 date = comstr(CAM,[-3])#

Return the standard date string. Used by ufwrite, naswrite, etc. See also date, datenum.

-4 CAM = comstr(CAM,[-4 nc ])#

Fills the string CAM with blanks up to nc characters.

-5 comstr(Matrix,[-5 fid],'format')#

Formatted output of Matrix, the format is repeated as many times as Matrix has columns and a formatted output to fid (default is 1 standard output). For example you might use comstr(ii_mac(md1,md2)*100,[-5 1],'%6.0f').

-7 st1=comstr(st1,-7,'string')#

used for dynamic messaging on the command line. On UNIX platforms (the backspace does not work properly on Windows), the string st1 is erased before 'string' is displayed.

-17 Tab, comstr(tt,-17,'type')#

This has been moved to vhandle.tab.

-38 [i0,st2]=comstr(st1,-38)#

Checks whether provided string st1 is valid to be a structure field. Output i0 is a boolean, true if valid, false otherwise. Output st2 is equal to input st1 if the string is valid. If not, st2 is an alternative valid suggestion based on st1.

See also

commode