Paulstott
asked on
VB functions in delphi
Hi EE
I was wondering if there was a left, mid, right and split functions in delphi? Also I want to remove/replace any ' characters in a string is this possible?
Thanks in advance
Paul
I was wondering if there was a left, mid, right and split functions in delphi? Also I want to remove/replace any ' characters in a string is this possible?
Thanks in advance
Paul
ASKER
Hi Ziolko,
Thanks for your answer
Would you use the pos function with the copy()? Do you have any example of this?
With string replace I have tried:
StringReplace(aString, ' ' ', ' ', [rfReplaceAll, rfIgnoreCase]); and get an error message, how can I get rid of ' (apostrophe).
Is there a split function or a way to get round this?
Thanks for your answer
Would you use the pos function with the copy()? Do you have any example of this?
With string replace I have tried:
StringReplace(aString, ' ' ', ' ', [rfReplaceAll, rfIgnoreCase]); and get an error message, how can I get rid of ' (apostrophe).
Is there a split function or a way to get round this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
probably need to double up the '
StringReplace(aString, ' '' ', ' ', [rfReplaceAll, rfIgnoreCase]);
StringReplace(aString, ' '' ', ' ', [rfReplaceAll, rfIgnoreCase]);
Here is another split string function I have been using.
Passes back the first string up to the delimiter while also trimming the original string.
function SplitStr(Var AString : String; ADelim : String) : String;
var APos : Integer;
begin
Result := '';
APos := Pos(ADelim,AString);
if APos > 0 then
begin
Result := Copy(AString,1,APos-1);
AString := copy(Astring,APos+length(A delim),Max LongInt);
end
else
begin
Result := AString;
AString := '';
end;
end;
Passes back the first string up to the delimiter while also trimming the original string.
function SplitStr(Var AString : String; ADelim : String) : String;
var APos : Integer;
begin
Result := '';
APos := Pos(ADelim,AString);
if APos > 0 then
begin
Result := Copy(AString,1,APos-1);
AString := copy(Astring,APos+length(A
end
else
begin
Result := AString;
AString := '';
end;
end;
ASKER
Thanks for your help
ziolko.