HyperWorks Solvers

STR2INTARY

STR2INTARY

Previous topic Next topic No expanding text in this topic  

STR2INTARY

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Subroutine Type

Utility/Data Access

Definition

Converts string data into integer or integer array.

Use

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

Calling Syntax

Fortran

CALL STR2INTARY(STRG, ARRAY, NSIZE, ISTAT)

 

C

c_str2intary(strg, array, nsize, istat)

 

Python

[array, istat] = py_str2intary(array)

 

MATLAB

[array, istat] = m_str2intary(array)

Input Arguments

[string] STRG

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

Output Values

[integer] ARRAY

The string data, converted into an integer array.

 

[integer] NSIZE

Returns the number of integers found in the string, separated by spaces.

 

[integer] ISTAT

0

If the call to STR2INTARY was successful.

 

 

n

Any nonzero integer, returned if the call to STR2INTARY was unsuccessful.

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.

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 header msolvesub_c_include.h in the folder [install-path]\hwsolvers\usersub\c_src\include.

See Also:

MODFNC

STR2DBLARY

Data Access Subroutines