@@ -1130,7 +1130,8 @@ end program demo
1130
1130
1131
1131
#### Description
1132
1132
1133
- Returns a new string_type instance which holds the lowercase version of the character sequence hold by the input string.
1133
+ Returns a new string_type instance which holds the lowercase version of the
1134
+ character sequence hold by the input string.
1134
1135
1135
1136
#### Syntax
1136
1137
@@ -1150,7 +1151,7 @@ Elemental function.
1150
1151
1151
1152
#### Result Value
1152
1153
1153
- The Result is a scalar ` string_type ` value.
1154
+ The result is a scalar ` string_type ` value.
1154
1155
1155
1156
#### Example
1156
1157
@@ -1175,7 +1176,8 @@ end program demo
1175
1176
1176
1177
#### Description
1177
1178
1178
- Returns a new string_type instance which holds the uppercase version of the character sequence hold by the input string.
1179
+ Returns a new string_type instance which holds the uppercase version of the
1180
+ character sequence hold by the input string.
1179
1181
1180
1182
#### Syntax
1181
1183
@@ -1195,7 +1197,7 @@ Elemental function.
1195
1197
1196
1198
#### Result Value
1197
1199
1198
- The Result is a scalar ` string_type ` value.
1200
+ The result is a scalar ` string_type ` value.
1199
1201
1200
1202
#### Example
1201
1203
@@ -1220,9 +1222,13 @@ end program demo
1220
1222
1221
1223
#### Description
1222
1224
1223
- Returns a new string_type instance which holds the titlecase (or capitalized) version of the character sequence hold by the input string.
1224
- Capitalized version: The first alphabetical character of the input character sequence is transformed to uppercase unless it
1225
- follows a numeral and the rest of the characters in the sequence are transformed to lowercase.
1225
+ Returns a new string_type instance which holds the titlecase version
1226
+ of the character sequence hold by the input string.
1227
+ Title case: First character of every word in the sentence is converted to
1228
+ uppercase and the rest of the characters are converted to lowercase.
1229
+ A word is a contiguous sequence of character(s) which consists of alphabetical
1230
+ character(s) and numeral(s) only and doesn't exclude any alphabetical character
1231
+ or numeral present next to either of its 2 ends.
1226
1232
1227
1233
#### Syntax
1228
1234
@@ -1242,31 +1248,80 @@ Elemental function.
1242
1248
1243
1249
#### Result Value
1244
1250
1245
- The Result is a scalar ` string_type ` value.
1251
+ The result is a scalar ` string_type ` value.
1246
1252
1247
1253
#### Example
1248
1254
1249
1255
``` fortran
1250
- program demo
1251
- use stdlib_string_type
1256
+ program demo_to_title
1257
+ use stdlib_string_type, only: string_type, to_title
1252
1258
implicit none
1253
1259
type(string_type) :: string, titlecase_string
1254
1260
1255
- string = "Titlecase This String "
1256
- ! string <-- "Titlecase This String "
1261
+ string = "titlecase this string. "
1262
+ ! string <-- "titlecase this string. "
1257
1263
1258
1264
titlecase_string = to_title(string)
1259
- ! string <-- "Titlecase This String"
1260
- ! titlecase_string <-- "Titlecase this string"
1261
- end program demo
1265
+ ! string <-- "titlecase this string."
1266
+ ! titlecase_string <-- "Titlecase This String."
1267
+ end program demo_to_title
1268
+ ```
1269
+
1270
+ <!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1271
+ ### To\_ sentence function
1272
+
1273
+ #### Description
1274
+
1275
+ Returns a new string_type instance which holds the sentencecase
1276
+ version of the character sequence hold by the input string.
1277
+ Sentencecase version: The first alphabetical character of the input character sequence
1278
+ is transformed to uppercase unless it follows a numeral and the rest of the
1279
+ characters in the sequence are transformed to lowercase.
1280
+
1281
+ #### Syntax
1282
+
1283
+ ` sentencecase_string = [[stdlib_string_type(module): to_sentence(interface)]] (string) `
1284
+
1285
+ #### Status
1286
+
1287
+ Experimental
1288
+
1289
+ #### Class
1290
+
1291
+ Elemental function.
1292
+
1293
+ #### Argument
1294
+
1295
+ ` string ` : Instance of ` string_type ` . This argument is ` intent(in) ` .
1296
+
1297
+ #### Result Value
1298
+
1299
+ The result is a scalar ` string_type ` value.
1300
+
1301
+ #### Example
1302
+
1303
+ ``` fortran
1304
+ program demo_to_sentence
1305
+ use stdlib_string_type, only: string_type, to_sentence
1306
+ implicit none
1307
+ type(string_type) :: string, sentencecase_string
1308
+
1309
+ string = "sentencecase this string."
1310
+ ! string <-- "sentencecase this string."
1311
+
1312
+ sentencecase_string = to_sentence(string)
1313
+ ! string <-- "sentencecase this string."
1314
+ ! sentencecase_string <-- "Sentencecase this string."
1315
+ end program demo_to_sentence
1262
1316
```
1263
1317
1264
1318
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -->
1265
1319
### Reverse function
1266
1320
1267
1321
#### Description
1268
1322
1269
- Returns a new string_type instance which holds the reversed version of the character sequence hold by the input string.
1323
+ Returns a new string_type instance which holds the reversed version of the
1324
+ character sequence hold by the input string.
1270
1325
1271
1326
#### Syntax
1272
1327
@@ -1286,7 +1341,7 @@ Elemental function.
1286
1341
1287
1342
#### Result Value
1288
1343
1289
- The Result is a scalar ` string_type ` value.
1344
+ The result is a scalar ` string_type ` value.
1290
1345
1291
1346
#### Example
1292
1347
0 commit comments