Skip to content

Commit 006175d

Browse files
committed
Documented the newly created functions in stdlib_string_type.md
1 parent f36f0c1 commit 006175d

File tree

2 files changed

+191
-12
lines changed

2 files changed

+191
-12
lines changed

doc/specs/stdlib_string_type.md

+179
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,185 @@ end program demo
10411041
```
10421042

10431043

1044+
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1045+
### To\_lower function
1046+
1047+
#### Description
1048+
1049+
Returns a new string_type instance which holds the lowercase version of the character sequence hold by the input string.
1050+
1051+
#### Syntax
1052+
1053+
`lowercase_string = [[stdlib_string_type(module): to_lower(interface)]] (string)`
1054+
1055+
#### Status
1056+
1057+
Experimental
1058+
1059+
#### Class
1060+
1061+
Elemental function.
1062+
1063+
#### Argument
1064+
1065+
`string`: Instance of `string_type`. This argument is `intent(in)`.
1066+
1067+
#### Result Value
1068+
1069+
The Result is a scalar `string_type` value.
1070+
1071+
#### Example
1072+
1073+
```fortran
1074+
program demo
1075+
use stdlib_string_type
1076+
implicit none
1077+
type(string_type) :: string, lowercase_string
1078+
1079+
string = "Lowercase This String"
1080+
! string <-- "Lowercase This String"
1081+
1082+
lowercase_string = to_lower(string)
1083+
! string <-- "Lowercase This String"
1084+
! lowercase_string <-- "lowercase this string"
1085+
end program demo
1086+
```
1087+
1088+
1089+
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1090+
### To\_upper function
1091+
1092+
#### Description
1093+
1094+
Returns a new string_type instance which holds the uppercase version of the character sequence hold by the input string.
1095+
1096+
#### Syntax
1097+
1098+
`uppercase_string = [[stdlib_string_type(module): to_upper(interface)]] (string)`
1099+
1100+
#### Status
1101+
1102+
Experimental
1103+
1104+
#### Class
1105+
1106+
Elemental function.
1107+
1108+
#### Argument
1109+
1110+
`string`: Instance of `string_type`. This argument is `intent(in)`.
1111+
1112+
#### Result Value
1113+
1114+
The Result is a scalar `string_type` value.
1115+
1116+
#### Example
1117+
1118+
```fortran
1119+
program demo
1120+
use stdlib_string_type
1121+
implicit none
1122+
type(string_type) :: string, uppercase_string
1123+
1124+
string = "Uppercase This String"
1125+
! string <-- "Uppercase This String"
1126+
1127+
uppercase_string = to_upper(string)
1128+
! string <-- "Uppercase This String"
1129+
! uppercase_string <-- "UPPERCASE THIS STRING"
1130+
end program demo
1131+
```
1132+
1133+
1134+
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1135+
### To\_title function
1136+
1137+
#### Description
1138+
1139+
Returns a new string_type instance which holds the titlecase version of the character sequence hold by the input string.
1140+
1141+
#### Syntax
1142+
1143+
`titlecase_string = [[stdlib_string_type(module): to_title(interface)]] (string)`
1144+
1145+
#### Status
1146+
1147+
Experimental
1148+
1149+
#### Class
1150+
1151+
Elemental function.
1152+
1153+
#### Argument
1154+
1155+
`string`: Instance of `string_type`. This argument is `intent(in)`.
1156+
1157+
#### Result Value
1158+
1159+
The Result is a scalar `string_type` value.
1160+
1161+
#### Example
1162+
1163+
```fortran
1164+
program demo
1165+
use stdlib_string_type
1166+
implicit none
1167+
type(string_type) :: string, titlecase_string
1168+
1169+
string = "Titlecase This String"
1170+
! string <-- "Titlecase This String"
1171+
1172+
titlecase_string = to_title(string)
1173+
! string <-- "Titlecase This String"
1174+
! titlecase_string <-- "Titlecase this string"
1175+
end program demo
1176+
```
1177+
1178+
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1179+
### Reverse function
1180+
1181+
#### Description
1182+
1183+
Returns a new string_type instance which holds the reversed version of the character sequence hold by the input string.
1184+
1185+
#### Syntax
1186+
1187+
`reverse_string = [[stdlib_string_type(module): reverse(interface)]] (string)`
1188+
1189+
#### Status
1190+
1191+
Experimental
1192+
1193+
#### Class
1194+
1195+
Elemental function.
1196+
1197+
#### Argument
1198+
1199+
`string`: Instance of `string_type`. This argument is `intent(in)`.
1200+
1201+
#### Result Value
1202+
1203+
The Result is a scalar `string_type` value.
1204+
1205+
#### Example
1206+
1207+
```fortran
1208+
program demo
1209+
use stdlib_string_type
1210+
implicit none
1211+
type(string_type) :: string, reverse_string
1212+
1213+
string = "Reverse This String"
1214+
! string <-- "Reverse This String"
1215+
1216+
reverse_string = reverse(string)
1217+
! string <-- "Reverse This String"
1218+
! reverse_string <-- "gnirtS sihT esreveR"
1219+
end program demo
1220+
```
1221+
1222+
10441223
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
10451224
### Comparison operator greater
10461225

src/stdlib_string_type.f90

+12-12
Original file line numberDiff line numberDiff line change
@@ -93,34 +93,34 @@ module stdlib_string_type
9393
module procedure :: repeat_string
9494
end interface repeat
9595

96-
!> Convert the character sequence hold by the input string to lower case
96+
!> Returns the lowercase version of the character sequence hold by the input string
9797
!>
98-
!> This method is Elemental and returns a new string_type instance which holds lowercase
99-
!> version of the character sequence hold by the input string
98+
!> This method is Elemental and returns a new string_type instance which holds this
99+
!> lowercase character sequence
100100
interface to_lower
101101
module procedure :: to_lower_string
102102
end interface to_lower
103103

104-
!> Convert the character sequence hold by the input string to upper case
104+
!> Returns the uppercase version of the character sequence hold by the input string
105105
!>
106-
!> This method is Elemental and returns a new string_type instance which holds uppercase
107-
!> version of the character sequence hold by the input string
106+
!> This method is Elemental and returns a new string_type instance which holds this
107+
!> uppercase character sequence
108108
interface to_upper
109109
module procedure :: to_upper_string
110110
end interface to_upper
111111

112-
!> Convert the character sequence hold by the input string to title case
112+
!> Returns the titlecase version of the character sequence hold by the input string
113113
!>
114-
!> This method is Elemental and returns a new string_type instance which holds titlecase
115-
!> version of the character sequence hold by the input string
114+
!> This method is Elemental and returns a new string_type instance which holds this
115+
!> titlecase character sequence
116116
interface to_title
117117
module procedure :: to_title_string
118118
end interface to_title
119119

120-
!> Reverse the character sequence hold by the input string
120+
!> Reverses the character sequence hold by the input string
121121
!>
122-
!> This method is Elemental and returns a new string_type instance which holds reversed
123-
!> sequence of the character sequence hold by the input string
122+
!> This method is Elemental and returns a new string_type instance which holds this
123+
!> reverse character sequence
124124
interface reverse
125125
module procedure :: reverse_string
126126
end interface reverse

0 commit comments

Comments
 (0)