SRL Archive - SRL Suggestions

EndsWith


weequ

2013-01-06 20:02:04

Well since since srl already contains StartsWith(prefix, s: string) i'm suggesting the addition of EndsWith(suffix, s: string);

Here is the code

function EndsWith(suffix, s: String): boolean;
begin
Result := suffix = Copy(s, Length(s)-Length(suffix)+1, Length(suffix));
end;

Btw where is the StartsWith located in the include? I couldn't find.

riwu

2013-01-06 20:06:59

StartsWith is located in srl/core/simba.simba ;)
Good work!

masterBB

2013-01-06 20:24:00

CTRL + click -> goes to the declaration of the variable/function.

or

Search for it in the function list on the left and double click on it.

Rezozo

2013-01-06 20:37:28

Very nice.

And hold up…since when was MasterBB a mod…^^^
~Rez

weequ

2013-01-06 20:40:49

From: masterBB
CTRL + click -> goes to the declaration of the variable/function.

or

Search for it in the function list on the left and double click on it.
Thanks.

From: Rezozo
Very nice.

And hold up…since when was MasterBB a mod…^^^
~Rez
Market mod since today :) Grazz for that MasterBB.

Ian

2013-01-06 20:43:08

From: Rezozo
Very nice.

And hold up…since when was MasterBB a mod…^^^
~Rez


Since the recent scamming I think.

OT: looks nice, good job! :)

Echo_

2013-01-07 00:51:45

I found this to be slightly faster:
function EndsWith(Suffix, S: string): Boolean;
begin
Delete(S, 1, Length(S) - Length(Suffix));
Result := Suffix = S;
end;

But wouldn't really matter unless your using it alot. Nice job :thumbsup:

weequ

2013-01-09 10:45:05

From: Echo_
I found this to be slightly faster:
function EndsWith(Suffix, S: string): Boolean;
begin
Delete(S, 1, Length(S) - Length(Suffix));
Result := Suffix = S;
end;

But wouldn't really matter unless your using it alot. Nice job :thumbsup:
Cool. That changes the String S but only inside the function EndsWith because the parameter S is not a var?