Hello.
can u help me.
I have a code:
and i need use in this button functions "Delete(Str: String; Start, Length: Integer)".Code:procedure Tpa.Button2Click(Sender: TObject); var Temp: TStringList; Index: Integer; s: Integer; begin Temp:= TStringList.Create(); try for Index:= 0 to FList.Count - 1 do if ('apple', FList[Index]) <> 0) and (Temp.IndexOf(FList[Index]) = -1) then Temp.Add(FList[Index]); try begin Temp.SaveToFile('fruits.txt'); end; except ShowMessage('error!'); end; finally Temp.Free(); end; end;
I need to remove all 'garbage' after this word.
How do I do this?
example:
'apple ererewerwer'
result:
only 'apple'
How are you defining the end of a word? For example, if you have 'apple ererewerwer' in string Data, then I could do:
to remove all characters starting at the space.Code:Data := copy(Data,1,pos(' ',Data)-1);
ok. but if i have 'applesdfsdfsdf' without the space?
How are you defining "garbage"? For example, your case could return either 'apple' or 'apples' depending on whether the s is considered garbage or not.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks