CAMP 1.0.0
Chemistry Across Multiple Phases
Public Member Functions | Public Attributes | List of all members
camp_util::string_t Interface Reference

String type for building arrays of string of various size. More...

Public Member Functions

final string_t_finalize (this)
 Finalize the string.
 

Public Attributes

character(len=:), allocatable string
 String value.
 

Splits a string on a sub-string

procedure, private split_char (this, splitter, compress)
 Splits a string on a substring.
 
procedure, private split_string (this, splitter, compress)
 Splits a string on a substring.
 
generic split (this, splitter, compress)
 Splits a string on a substring.
 
generic split (this, splitter, compress)
 Splits a string on a substring.
 

Detailed Description

String type for building arrays of string of various size.

Constructor for string_t.

Definition at line 38 of file util.F90.

Constructor & Destructor Documentation

◆ string_t_finalize()

final camp_util::string_t::string_t_finalize ( type(string_t), intent(inout)  this)
final

Finalize the string.

Parameters
[in,out]thisString to finalize

Definition at line 49 of file util.F90.

Here is the call graph for this function:

Member Function/Subroutine Documentation

◆ split() [1/2]

generic camp_util::string_t::split ( class(string_t), intent(in)  this,
character(len=*), intent(in)  splitter,
logical, intent(in), optional  compress 
)

Splits a string on a substring.

Example:

type(string_t) :: my_string
type(string_t), allocatable :: sub_strings(:)
integer :: i
my_string = "my original string"
sub_strings = my_string%split( ' ' )
do i = 1, size( sub_strings )
write(*,*) i, sub_strings( i )
end do
sub_strings = my_string%split( ' ', .true. )
do i = 1, size( sub_strings )
write(*,*) i, sub_strings( i )
end do

Output:

1 my
2 original
3
4
5
6 string
1 my
2 original
3 string
Returns
Split string
Parameters
[in]thisFull string
[in]splitterString to split on
[in]compressCompress (default = false)

No 0-length substrings will be returned (adjacent tokens will be merged; tokens at the beginning and end of the original string will be ignored)

Definition at line 46 of file util.F90.

Here is the call graph for this function:

◆ split() [2/2]

generic camp_util::string_t::split ( class(string_t), intent(in)  this,
type(string_t), intent(in)  splitter,
logical, intent(in), optional  compress 
)

Splits a string on a substring.

See string_split_char for description and example

Returns
Split string
Parameters
[in]thisFull string
[in]splitterString to split on
[in]compressCompress (default = false)

No 0-length substrings will be returned (adjacent tokens will be merged; tokens at the beginning and end of the original string will be ignored)

Definition at line 46 of file util.F90.

◆ split_char()

procedure, private camp_util::string_t::split_char ( class(string_t), intent(in)  this,
character(len=*), intent(in)  splitter,
logical, intent(in), optional  compress 
)
private

Splits a string on a substring.

Example:

type(string_t) :: my_string
type(string_t), allocatable :: sub_strings(:)
integer :: i
my_string = "my original string"
sub_strings = my_string%split( ' ' )
do i = 1, size( sub_strings )
write(*,*) i, sub_strings( i )
end do
sub_strings = my_string%split( ' ', .true. )
do i = 1, size( sub_strings )
write(*,*) i, sub_strings( i )
end do

Output:

1 my
2 original
3
4
5
6 string
1 my
2 original
3 string
Returns
Split string
Parameters
[in]thisFull string
[in]splitterString to split on
[in]compressCompress (default = false)

No 0-length substrings will be returned (adjacent tokens will be merged; tokens at the beginning and end of the original string will be ignored)

Definition at line 44 of file util.F90.

◆ split_string()

procedure, private camp_util::string_t::split_string ( class(string_t), intent(in)  this,
type(string_t), intent(in)  splitter,
logical, intent(in), optional  compress 
)
private

Splits a string on a substring.

See string_split_char for description and example

Returns
Split string
Parameters
[in]thisFull string
[in]splitterString to split on
[in]compressCompress (default = false)

No 0-length substrings will be returned (adjacent tokens will be merged; tokens at the beginning and end of the original string will be ignored)

Definition at line 45 of file util.F90.

Member Data Documentation

◆ string

character(len=:), allocatable camp_util::string_t::string

String value.

Definition at line 40 of file util.F90.


The documentation for this interface was generated from the following file: