Commit cbbd4bf1 authored by shane.stimpson's avatar shane.stimpson Committed by Henderson, Shane
Browse files

Adding %stob.

Squash branch 'stol' into 'master'

* Updating naming.

* Fixing documentation.

* Adding %stol.

<!-- Replace this a detailed description of changes -->

<!-- Include a link to VERA development issues if appropriate, or delete this line -->

**Developer Checklist:**
- [x] Have you done a self-review after creating the merge request?
- [x] Have you filled in the Merge Request information (title, description) thoroughly?
- [x] Have you updated the relevant tickets (if this MR is linked to any VERA-dev tickets)?
- [x] Have you addressed all suggested feedback and commented on it to let the reviewer know? (Do not resolve discussions that the reviewer started)

**Reviewer Checklist:**
- [x] Have you confirmed all discussions were adequately addressed and resolved them all?
- [x] Does it conform to formatting guidelines?
- [x] Are there adequate and clear comments?
- [x] Is the design clean and sensible?
- [x] Are the changes optimal/efficient?
- [x] Were sufficient DBC checks added?
- [x] Are there unit tests? (if necessary)
- [x] Is the MR description clear, including a link to the VERA-Dev issue if appropriate?

**PSM Checklist**
- [x] Have you confirmed that all discussions were addressed, or that follow-on issues have been created for them?
- [x] Have you confirmed sufficient testing was conducted?
- [x] Does this impact other repositories?
- [x] Does the MR have an adequate description?
- [x] If the MR has multiple commits, did you set the MR to squash merge?

See merge request https://code.ornl.gov/futility/Futility/-/merge_requests/427
parent 1cd11bc6
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
@@ -116,6 +116,10 @@ TYPE :: StringType
    !> copydetails Strings::str_to_sik
    PROCEDURE,PASS :: str_to_sik
    GENERIC :: stoi => str_to_sik
    !> copybrief Strings::str_to_sbk
    !> copydetails Strings::str_to_sbk
    PROCEDURE,PASS :: str_to_sbk
    GENERIC :: stob => str_to_sbk
    !> copybrief Strings::str_to_srk
    !> copydetails Strings::str_to_srk
    PROCEDURE,PASS :: str_to_srk
@@ -1322,6 +1326,47 @@ ELEMENTAL FUNCTION str_to_sik(this,stt,stp) RESULT(i)
ENDFUNCTION str_to_sik
!
!-------------------------------------------------------------------------------
!> @brief convert a string to a logical
!> @param this the string being converted
!> @param stt position for starting conversion
!> @param stp end of conversion
!> @returns l the logical that will be output
!>
ELEMENTAL FUNCTION str_to_sbk(this,stt,stp) RESULT(l)
  CLASS(StringType),INTENT(IN) :: this
  INTEGER(SIK),INTENT(IN),OPTIONAL :: stt
  INTEGER(SIK),INTENT(IN),OPTIONAL :: stp
  LOGICAL(SBK) :: l
  !
  INTEGER(SIK) :: begStr,endStr,ioerr
  TYPE(StringType) :: tmpstr

  !Bypass the world if the string isn't allocated
  ioerr = -HUGE(ioerr)
  IF(ALLOCATED(this%s)) THEN
    !Find the beginning
    IF(PRESENT(stt)) THEN
      begStr = stt
    ELSE
      begStr = 1
    ENDIF
    !Find the end
    IF(PRESENT(stp)) THEN
      endStr = stp
    ELSE
      endStr = LEN(this%s)
    ENDIF
    tmpstr = this%s(begStr:endStr)
    tmpstr = tmpstr%upper()
    l=.FALSE.
    IF(TRIM(tmpstr) == "T" .OR. TRIM(tmpstr) == "TRUE" .OR. TRIM(tmpstr) == "1") THEN
      l=.TRUE.
    ENDIF
  ENDIF

ENDFUNCTION str_to_sbk
!
!-------------------------------------------------------------------------------
!> @brief convert a string to a float
!> @param this the string being converted
!> @param stt position for starting conversion