[M3commit] CVS Update: cm3
Jay Krell
jkrell at elego.de
Fri Jul 24 07:45:34 CEST 2009
CVSROOT: /usr/cvs
Changes by: jkrell at birch. 09/07/24 07:45:34
Modified files:
cm3/m3-libs/sysutils/src/: TextUtils.i3
cm3/m3-libs/sysutils/src/cm3/: TextUtils.m3
cm3/m3-libs/sysutils/src/pm3/: TextUtils.m3
Log message:
add:
(*---------------------------------------------------------------------------*)
PROCEDURE StartsWith(s, t : TEXT; caseSensitive := TRUE) : BOOLEAN =
VAR
tlen := Text.Length(t);
slen := Text.Length(s);
sub: TEXT;
BEGIN
IF tlen > slen THEN
RETURN FALSE;
END;
sub := Text.Sub(s, 0, tlen);
IF caseSensitive THEN
RETURN Text.Equal(sub, t);
END;
RETURN TextEx.CIEqual(sub, t);
END StartsWith;
(*---------------------------------------------------------------------------*)
PROCEDURE EndsWith(s, t : TEXT; caseSensitive := TRUE) : BOOLEAN =
VAR
tlen := Text.Length(t);
slen := Text.Length(s);
sub: TEXT;
BEGIN
IF tlen > slen THEN
RETURN FALSE;
END;
sub := Text.Sub(s, slen - tlen, tlen);
IF caseSensitive THEN
RETURN Text.Equal(sub, t);
END;
RETURN TextEx.CIEqual(sub, t);
END EndsWith;
More information about the M3commit
mailing list