Skip to content

Instantly share code, notes, and snippets.

@parthsarthiprasad
Created March 27, 2020 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parthsarthiprasad/cd9305f1fa984e26d07a9bfeb132d651 to your computer and use it in GitHub Desktop.
Save parthsarthiprasad/cd9305f1fa984e26d07a9bfeb132d651 to your computer and use it in GitHub Desktop.
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);}
else
{writeln(false);}
if doComp(i, j, 1, 4)
{writeln(true);}
else
{writeln(false);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment