Mercurial Hosting > luan
comparison website/src/manual.html.luan @ 1721:5c69d2e8bd75
no regex in String.find and String.split
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 26 Jul 2022 12:44:52 -0600 |
parents | 2f3a8f16f583 |
children | 7d2ab44f7a59 |
comparison
equal
deleted
inserted
replaced
1720:2f4c99c02436 | 1721:5c69d2e8bd75 |
---|---|
2444 </p> | 2444 </p> |
2445 <% | 2445 <% |
2446 end | 2446 end |
2447 } | 2447 } |
2448 ["String.find"] = { | 2448 ["String.find"] = { |
2449 title = "<code>String.find (s, pattern [, init [, plain]])</code>" | 2449 title = "<code>String.find (s, s2 [, init])</code>" |
2450 content = function() | 2450 content = function() |
2451 %> | 2451 %> |
2452 <p> | 2452 <p> |
2453 Looks for the first match of | 2453 Looks for the first substring |
2454 <code>pattern</code> (see <a href="http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html">Pattern</a>) in the string <code>s</code>. | 2454 <code>s2</code> in the string <code>s</code>. |
2455 If it finds a match, then <code>find</code> returns the indices of <code>s</code> | 2455 If it finds a match, then <code>find</code> returns the indices of <code>s</code> |
2456 where this occurrence starts and ends; | 2456 where this occurrence starts and ends; |
2457 otherwise, it returns <b>nil</b>. | 2457 otherwise, it returns <b>nil</b>. |
2458 A third, optional numerical argument <code>init</code> specifies | 2458 A third, optional numerical argument <code>init</code> specifies |
2459 where to start the search; | 2459 where to start the search; |
2460 its default value is 1 and can be negative. | 2460 its default value is 1 and can be negative. |
2461 A value of <b>true</b> as a fourth, optional argument <code>plain</code> | |
2462 turns off the pattern matching facilities, | |
2463 so the function does a plain "find substring" operation, | |
2464 with no characters in <code>pattern</code> being considered magic. | |
2465 Note that if <code>plain</code> is given, then <code>init</code> must be given as well. | |
2466 </p> | 2461 </p> |
2467 | 2462 |
2468 <p> | 2463 <p> |
2469 If the pattern has captures, | 2464 If the pattern has captures, |
2470 then in a successful match | 2465 then in a successful match |
2707 </p> | 2702 </p> |
2708 <% | 2703 <% |
2709 end | 2704 end |
2710 } | 2705 } |
2711 ["String.split"] = { | 2706 ["String.split"] = { |
2712 title = "<code>String.split (s, pattern [, limit])</code>" | 2707 title = "<code>String.split (s, s2 [, limit])</code>" |
2713 content = function() | 2708 content = function() |
2714 %> | 2709 %> |
2715 <p> | 2710 <p> |
2716 Splits <code>s</code> using regex <code>pattern</code> and returns the results. If <code>limit</code> is positive, then only returns at most that many results. If <code>limit</code> is zero, then remove trailing empty results. | 2711 Splits <code>s</code> using substring <code>s2</code> and returns the results. If <code>limit</code> is positive, then only returns at most that many results. If <code>limit</code> is zero, then remove trailing empty results. |
2717 </p> | 2712 </p> |
2718 <% | 2713 <% |
2719 end | 2714 end |
2720 } | 2715 } |
2721 ["String.starts_with"] = { | 2716 ["String.starts_with"] = { |