SRL Archive - Help and Support

Substring


muna580

2006-07-06 20:53:23

I am looking for a fucnation or procedure that does the same thing as this method in java.

substring

public String substring(int beginIndex, int endIndex)

Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

Examples:

"hamburger".substring(4, 8) returns "urge"
"smiles".substring(1, 5) returns "mile"


Basicly, I want to make a new string out of another string from index x to index y.

Is there such a fucnation in pascal

WhiteShadow

2006-07-06 21:17:15

[PHP]//Used with declareplayers; user no longer needs to set .Nick
procedure SetNicks;
var
b : Integer;
begin
for b:= 0 to HowManyPlayers -1 do
begin
Players.Nick:= Copy(Players.Name, 2, 4);
end;
end;
[/PHP]

Copy I think you can get is easily just by testing around since you have experience with it already.

muna580

2006-07-07 02:46:04

Thanks, i just wanted to know about the copy funcation. Thanks to you, i know that wat i was trying to do can be done. I made a fucantion called SetNickname. check it out in the New Funcations forum.