Skip to content

Commit 492543d

Browse files
authored
Merge pull request #456 from Aman-Godara/replace_all
slice function's documentation made user friendly
2 parents 21c888e + ca82b5e commit 492543d

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

doc/specs/stdlib_strings.md

+13-17
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,21 @@ end program demo
199199

200200
#### Description
201201

202-
Extracts the characters from the defined region of the input string by taking strides.
202+
Extracts the characters from the defined region of the input string by taking strides.
203+
Argument `first` and `last` defines this region for extraction by function `slice`.
204+
Argument `stride` defines the magnitude and direction (+/-) of stride to be taken while extraction.
205+
`stride` when given invalid value 0, is converted to +1.
203206

204-
Deduction Process:
207+
Deduction Process:
205208
Function first automatically deduces the optional arguments that are not provided by the user.
206-
This process is independent of both input `string` and permitted indexes of Fortran.
207-
Deduced `first` and `last` argument take +infinity or -infinity value whereas deduced `stride` argument takes +1 or -1 value.
208-
209-
Validation Process:
210-
Argument `first` and `last` defines this region for extraction by function `slice`.
211-
If the defined region is invalid i.e. region contains atleast one invalid index, `first` and
212-
`last` are converted to first and last valid indexes in this defined region respectively,
213-
if no valid index exists in this region an empty string is returned.
214-
`stride` can attain both negative or positive values but when the only invalid value
215-
0 is given, it is converted to 1.
216-
217-
Extraction Process:
218-
After all this, extraction starts from `first` index and takes stride of length `stride`.
219-
Extraction starts only if `last` index is crossable from `first` index with stride `stride`
220-
and remains active until `last` index is crossed.
209+
Deduced `first` and `last` argument take +infinity or -infinity value and deduced `stride` argument
210+
takes value +1 or -1 depending upon the actual argument(s) provided by the user.
211+
212+
Extraction Process:
213+
Extraction starts only if `last` is crossable from `first` with stride of `stride`.
214+
Extraction starts from the first valid index in the defined region to take stride of `stride`
215+
and ends when the last valid index in the defined region is crossed.
216+
If no valid index exists in the defined region, empty string is returned.
221217

222218
#### Syntax
223219

0 commit comments

Comments
 (0)