This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use String; | |
use ByteBufferHelpers; | |
inline proc doComp(a: ?t1, b: ?t2, c:int, d:int) { | |
return _strcmp(a.buff+c-1, d-c+1, a.locale_id, b.buff, b.len, b.locale_id) == 0; | |
} | |
var i : string = "asdfasdf5"; | |
var j : string = "asdf"; | |
if doComp(i, j, 1, 5) | |
{writeln(true);} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline proc findAll(needle: string, region: range(?) = 1:byteIndex..): [] | |
{ | |
/* | |
find all occurrences of needle in string. | |
return type :- integer array containing starting indices of matched pattern. (1-based indexing) | |
empty array if no index found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***** | |
rw_png_v2.chpl - | |
Program that reads a PNG file from disk, prints the RGB values found | |
at one pixel, changes it to 1, 2, 3, and writes the change to disk. | |
This version accesses the image data directly from Chapel. | |
Call: | |
rw_png_v2 | |
--inname=<file> file to read from |