Skip to content

Commit 7c8a8fb

Browse files
authored
Merge branch 'master' into add_close
2 parents 909d492 + eae0027 commit 7c8a8fb

14 files changed

+2075
-1
lines changed

doc/specs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This is and index/directory of the specifications (specs) for each new module/fe
2626
- [stats_distribution_PRNG](./stdlib_stats_distribution_PRNG.html) - Probability Distributions random number generator
2727
- [string\_type](./stdlib_string_type.html) - Basic string support
2828
- [strings](./stdlib_strings.html) - String handling and manipulation routines
29+
- [stringlist_type](./stdlib_stringlist_type.html) - 1-Dimensional list of strings
2930

3031
## Released/Stable Features & Modules
3132

doc/specs/stdlib_string_type.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,3 +1972,58 @@ program demo
19721972
close(io)
19731973
end program demo
19741974
```
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_type` instance 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_move
2009+
use stdlib_string_type, only : string_type, assignment(=), move
2010+
implicit none
2011+
type(string_type) :: from_string
2012+
character(len=:), allocatable :: from_char, to_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_char <-- (unallocated)
2019+
2020+
call move(from_string, to_char)
2021+
! from_string <-- ""
2022+
! to_char <-- "move this string"
2023+
2024+
call move(from_char, to_char)
2025+
! from_char <-- (unallocated)
2026+
! to_string <-- "move this char"
2027+
2028+
end program demo_move
2029+
```

0 commit comments

Comments
 (0)