logo       

[jira] Commented: (BOO-490) Doesn't get the type from .{3}\w+/.Matches(sHTM: msg#00069

lang.boo.devel

Subject: [jira] Commented: (BOO-490) Doesn't get the type from .{3}\w+/.Matches(sHTML)

[ http://jira.codehaus.org/browse/BOO-490?page=comments#action_46365 ]

Doug Holton commented on BOO-490:
---------------------------------

I don't think Boo can infer the type of this IEnumerable unless it had an
[EnumeratorItemType(Match)] attribute (which only Boo.Lang.dll collections do).
So you need the "as Match" part (later with generics you won't need this
either):

import System.Text.RegularExpressions
sHTML="Yadada"
for m as Match in /.{3}\w+/.Matches(sHTML):
print m.Value


The type is known from the MatchCollection indexer though, but this isn't as
pretty code:

sHTML="Yadada"
matches = /.{3}\w+/.Matches(sHTML)
i=0
while i<matches.Count:
print matches[i].Value
++i


> Doesn't get the type from .{3}\w+/.Matches(sHTML)
> -------------------------------------------------
>
> Key: BOO-490
> URL: http://jira.codehaus.org/browse/BOO-490
> Project: Boo
> Type: Bug
> Versions: 0.6
> Environment: win xp pro en with de-ch locales
> Reporter: Philipp Knecht

>
>
> Try:
> sHTML="Yadada"
> for m in /.{3}\w+/.Matches(sHTML):
> print m.Value
> Will give an compiletime - error.
> But is should know the type since Matches(xyz) returns a MatchCollection

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise