Skip to content

Commit fc571c1

Browse files
committed
Implement nqp::replace op.
1 parent 41e4fb0 commit fc571c1

File tree

1 file changed

+4
-0
lines changed
  • src/vm/jvm/runtime/org/perl6/nqp/runtime

1 file changed

+4
-0
lines changed

src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,10 @@ public static String flip(String str) {
25402540
return new StringBuffer(str).reverse().toString();
25412541
}
25422542

2543+
public static String replace(String str, long offset, long count, String repl) {
2544+
return new StringBuffer(str).replace((int)offset, (int)(offset + count), repl).toString();
2545+
}
2546+
25432547
/* Brute force, but not normally needed for most programs. */
25442548
private static HashMap<String, Character> cpNameMap;
25452549
public static long codepointfromname(String name) {

0 commit comments

Comments
 (0)