dolphin King
asked on
control image tags in a string ?
i have a string that contain those 6 image tags
i want to control on that string so if the images string longer than or equal 6 remove the last 3 image tags from string .
how can i achieve that in coding
StringI := '<img src="'path'"><img src="'path'"><img src="'path'"><img src="'path'"><img src="'path'"><img src="'path'">';
i want to control on that string so if the images string longer than or equal 6 remove the last 3 image tags from string .
how can i achieve that in coding
@i want to control on that string so if the images string longer than or equal 6 remove the last 3 image tags from string .
Do you mean that you need just the first 3 img tags from the string?
If so you could use a function like this:
Do you mean that you need just the first 3 img tags from the string?
If so you could use a function like this:
uses StrUtils;
function FirstThreeImgTags(S: String): string;
var
p, t, i: integer;
begin
p := 0;
i := 1;
while i <= 3 do
begin
p := posex('>', S, p+1);
if p = 0 then
break
else
t := p;
inc(i);
end;
result := copy(S, 1, t);
end;
ASKER
this text will be dynamic as example
i need to control on how Manny images Tags on that string
@Ferruccio Accalai your code clear all the text even without images on it also i use this method in dll application not exe
@Pierre Cornelius This cannot be array its changeable string it does not have stable text or identification
strsm := 'Hi there My name is Trunk and this is my images <img src=""><img src=""> But This images need to be controlled <img src=""><img src=""><img src=""><img src="">';
i need to control on how Manny images Tags on that string
@Ferruccio Accalai your code clear all the text even without images on it also i use this method in dll application not exe
@Pierre Cornelius This cannot be array its changeable string it does not have stable text or identification
how do those tags get in that text ?
where is the source of those texts coming from ?
where is the source of those texts coming from ?
ASKER
@Geert Gruwez those tags are inserted from Tedit control so they can be changeable and not only images
So your form is used to generate the string
Well, do the checks upon generating the string
Checking after with parsing is more difficult
Well, do the checks upon generating the string
Checking after with parsing is more difficult
Why a deletion request without giving more inputs?
In the first question the request was about something that seems different from the real needs.
It's hard to give the right answer to a not completely clear question.
In the first question the request was about something that seems different from the real needs.
It's hard to give the right answer to a not completely clear question.
our answers are not helpful because you are not responding to our questions
this will be the same for every question you ask here
you didn't post any of your code either
so we are second guessing at what's really going on
which, btw, you didn't explain either
this will be the same for every question you ask here
you didn't post any of your code either
so we are second guessing at what's really going on
which, btw, you didn't explain either
ASKER
@Ferruccio Accalai i have gives you more details see the following quote
@Geert Gruwez giving more explanation already posted above ! which kind of codes i have to post ? the question were about how to do it. that's means i am unable to write a solution myself .
this text will be dynamic as example
strsm := 'Hi there My name is Trunk and this is my images <img src=""><img src=""> But This images need to be controlled <img src=""><img src=""><img src=""><img src="">';
Open in new window
i need to control on how Manny images Tags on that string
@Ferruccio Accalai your code clear all the text even without images on it also i use this method in dll application not exe
@Pierre Cornelius This cannot be array its changeable string it does not have stable text or identification
@Geert Gruwez giving more explanation already posted above ! which kind of codes i have to post ? the question were about how to do it. that's means i am unable to write a solution myself .
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thats works Thanks
Open in new window