STR2INTARY

Utility/Data Access SubroutineConverts string data into integer or integer array.

Use

The function can be called by any user-defined subroutine.

Format

Fortran Calling Syntax
CALL STR2INTARY(STRG, ARRAY, NSIZE, ISTAT)
C/C++ Calling Syntax
c_str2intary(strg, array, nsize, istat)
Python Calling Syntax
[array, istat] = py_str2intary(array)
MATLAB Calling Syntax
[array, istat] = m_str2intary(array)

Attributes

STRG
[string]
A string variable containing the data to be converted into integer.

Output

ARRAY
[integer]
The string data, converted into an integer array.
NSIZE
[integer]
Returns the number of integers found in the string, separated by spaces.
ISTAT
[integer]
0
If the call to STR2INTARY was successful.
n
Any nonzero integer, returned if the call to STR2INTARY was unsuccessful.

Example

To access the body_id of the marker with id=30101010 in the XML file as follows:

<Reference_Marker
     id                  = "30101010"
     body_id             = "30101"
     body_type           = "RigidBody"
  />

from a Fortran user subroutine you may call

CALL MODFNC('Reference_Marker',30101010,'body_id', STRG,INFO)
CALL STR2INTARY(STRG, ARRAY, NSIZE, ISTAT)

In this example, the STRG returns a value of '30101' and the INFO returns a value of 2, indicating a single integer. The subsequent call to STR2INTARY using STRG as input yields an output ARRAY(1)=30101, NSIZE=1, and ISTAT=0 (normal return).

The prototypes of STR2INTARY and STR2DBLARY can be found in the C include headermsolvesub_c_include.h in the folder [install-path]\hwsolvers\usersub\c_src\include.

Comments

  1. STR2INTARY is useful for processing the string output from MODFNC subroutine.
  2. You are responsible for providing sufficient storage in the output array.