@@ -1972,3 +1972,58 @@ program demo
1972
1972
close(io)
1973
1973
end program demo
1974
1974
```
1975
+
1976
+
1977
+ <!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1978
+ ### move
1979
+
1980
+ #### Description
1981
+
1982
+ Moves the allocation from ` from ` to ` to ` , consequently deallocating ` from ` in this process.
1983
+ If ` from ` is not allocated before execution, ` to ` gets deallocated by the process.
1984
+ An unallocated string is equivalent to an empty string.
1985
+
1986
+ #### Syntax
1987
+
1988
+ ` call [[stdlib_string_type(module):move(interface)]] (from, to) `
1989
+
1990
+ #### Status
1991
+
1992
+ Experimental
1993
+
1994
+ #### Class
1995
+
1996
+ Pure Subroutine.
1997
+
1998
+ #### Argument
1999
+
2000
+ - ` from ` : Character scalar or [[ stdlib_string_type(module): string_type (type)]] .
2001
+ This argument is ` intent(inout) ` .
2002
+ - ` to ` : Character scalar or [[ stdlib_string_type(module): string_type (type)]] .
2003
+ This argument is ` intent(out) ` .
2004
+
2005
+ #### Example
2006
+
2007
+ ``` fortran
2008
+ program demo
2009
+ use stdlib_string_type, only : string_type, assignment(=), move
2010
+ implicit none
2011
+ type(string_type) :: from_string, to_string
2012
+ character(len=:), allocatable :: from_char
2013
+
2014
+ from_string = "move this string"
2015
+ from_char = "move this char"
2016
+ ! from_string <-- "move this string"
2017
+ ! from_char <-- "move this char"
2018
+ ! to_string <-- "" (unallocated)
2019
+
2020
+ call move(from_string, to_string)
2021
+ ! from_string <-- "" (unallocated)
2022
+ ! to_string <-- "move this string"
2023
+
2024
+ call move(from_char, to_string)
2025
+ ! from_char <-- (unallocated)
2026
+ ! to_string <-- "move this char"
2027
+
2028
+ end program demo
2029
+ ```
0 commit comments