Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement .fc method and fc(...) sub.
Performs the Unicode foldcase operation. Unlike uc/tc/lc, it already
understands full mappings (where one grapheme may expand to many). It
is made available on JVM too, but is incomplete there.
  • Loading branch information
jnthn committed Oct 8, 2015
1 parent 54451b3 commit 912d208
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/Cool.pm
Expand Up @@ -100,6 +100,10 @@ my class Cool { # declared in BOOTSTRAP
self.Str.tc
}

method fc() {
self.Str.fc
}

method tclc() {
self.Str.tclc
}
Expand Down Expand Up @@ -347,6 +351,7 @@ sub lc(Cool $s) { $s.lc }
sub ord(Cool $s) { $s.ord }
sub uc(Cool $s) { $s.uc }
sub tc(Cool $s) { $s.tc }
sub fc(Cool $s) { $s.fc }
sub tclc(Cool $s) { $s.tclc }

sub indices(Cool $s,$needle,$pos=0,:$overlap) {
Expand Down
8 changes: 8 additions & 0 deletions src/core/Str.pm
Expand Up @@ -1435,6 +1435,14 @@ my class Str does Stringy { # declared in BOOTSTRAP
self.Str
}

proto method fc(|) { * }
multi method fc(Str:D:) {
nqp::p6box_s(nqp::fc($!value));
}
multi method fc(Str:U:) {
self.Str;
}

proto method tclc(|) { * }
multi method tclc(Str:D:) {
nqp::p6box_s(nqp::tclc($!value))
Expand Down

0 comments on commit 912d208

Please sign in to comment.