|
116 | 116 | (let _len (len _str)) |
117 | 117 | (while (< _i _len) { |
118 | 118 | (let _c (@ _str _i)) |
119 | | - (if (and (!= _c " ") (!= _c "\t") (!= _c "\n") (!= _c "\r")) |
120 | | - { |
121 | | - (set _all_spaces false) |
122 | | - (set _i _len) }) |
| 119 | + (if (and (!= _c " ") (!= _c "\t") (!= _c "\n") (!= _c "\r")) { |
| 120 | + (set _all_spaces false) |
| 121 | + (set _i _len) }) |
123 | 122 | (set _i (+ 1 _i)) }) |
124 | 123 | _all_spaces }))) |
125 | 124 |
|
|
326 | 325 |
|
327 | 326 | (while (< _index (len _list)) { |
328 | 327 | (set _output (+ |
329 | | - _output |
330 | | - (toString (@ _list _index)) |
331 | | - (if (!= _index (- (len _list) 1)) |
332 | | - _delim |
333 | | - ""))) |
| 328 | + _output |
| 329 | + (toString (@ _list _index)) |
| 330 | + (if (!= _index (- (len _list) 1)) |
| 331 | + _delim |
| 332 | + ""))) |
334 | 333 | (set _index (+ 1 _index)) }) |
335 | 334 | _output })) |
336 | 335 |
|
|
339 | 338 | (if (emptyOrWhitespace? _str) |
340 | 339 | "" |
341 | 340 | { |
342 | | - (mut _i (if (= 1 _dir) 0 (- (len _str) 1))) |
| 341 | + (mut _i |
| 342 | + (if (= 1 _dir) |
| 343 | + 0 |
| 344 | + (- (len _str) 1))) |
343 | 345 | (mut _whitespaces (or (= (@ _str _i) " ") (= (@ _str _i) "\t") (= (@ _str _i) "\n") (= (@ _str _i) "\r"))) |
344 | 346 |
|
345 | 347 | (while (and _whitespaces (< _i (len _str)) (>= _i 0)) { |
|
359 | 361 | # (print (string:lstrip " a b c")) # "a b c" |
360 | 362 | # =end |
361 | 363 | # @author https://github.com/SuperFola |
362 | | -(let lstrip (fun (_str) |
363 | | - (__strip_in_dir _str 1))) |
| 364 | +(let lstrip (fun (_str) (__strip_in_dir _str 1))) |
364 | 365 |
|
365 | 366 | # @brief Removes whitespaces from the right side of a string |
366 | 367 | # @details The original string isn't modified |
|
369 | 370 | # (print (string:rstrip " a b c ")) # " a b c" |
370 | 371 | # =end |
371 | 372 | # @author https://github.com/SuperFola |
372 | | -(let rstrip (fun (_str) |
373 | | - (__strip_in_dir _str -1))) |
| 373 | +(let rstrip (fun (_str) (__strip_in_dir _str -1))) |
374 | 374 |
|
375 | 375 | # @brief Removes whitespaces from both sides of a string |
376 | 376 | # @details The original string isn't modified |
|
379 | 379 | # (print (string:strip " a b c ")) # "a b c" |
380 | 380 | # =end |
381 | 381 | # @author https://github.com/SuperFola |
382 | | -(let strip (fun (_str) |
383 | | - (rstrip (lstrip _str)))) |
| 382 | +(let strip (fun (_str) (rstrip (lstrip _str)))) |
384 | 383 |
|
385 | 384 | # @brief Strip the margin of a multiline string |
386 | 385 | # @param _str multiline string, margin is (space)*(|) |
|
0 commit comments