@@ -206,6 +206,16 @@ module stdlib_string_type
206206 module procedure :: verify_char_string
207207 end interface verify
208208
209+ !> Version: experimental
210+ !>
211+ !> Moves the allocated character scalar from 'from' to 'to'
212+ !> [Specifications](../page/specs/stdlib_string_type.html#move)
213+ interface move
214+ module procedure :: move_string_string
215+ module procedure :: move_string_char
216+ module procedure :: move_char_string
217+ end interface move
218+
209219 !> Lexically compare the order of two character sequences being greater,
210220 !> The left-hand side, the right-hand side or both character sequences can
211221 !> be represented by a string.
@@ -721,6 +731,35 @@ contains
721731
722732 end function verify_char_string
723733
734+ !> Moves the allocated character scalar from 'from' to 'to'
735+ !> No output
736+ subroutine move_string_string(from, to)
737+ type(string_type), intent(inout) :: from
738+ type(string_type), intent(out) :: to
739+
740+ call move_alloc(from%raw, to%raw)
741+
742+ end subroutine move_string_string
743+
744+ !> Moves the allocated character scalar from 'from' to 'to'
745+ !> No output
746+ subroutine move_string_char(from, to)
747+ type(string_type), intent(inout) :: from
748+ character(len=:), intent(out), allocatable :: to
749+
750+ call move_alloc(from%raw, to)
751+
752+ end subroutine move_string_char
753+
754+ !> Moves the allocated character scalar from 'from' to 'to'
755+ !> No output
756+ subroutine move_char_string(from, to)
757+ character(len=:), intent(inout), allocatable :: from
758+ type(string_type), intent(out) :: to
759+
760+ call move_alloc(from, to%raw)
761+
762+ end subroutine move_char_string
724763
725764 !> Compare two character sequences for being greater.
726765 !> In this version both character sequences are by a string.
0 commit comments