Forum > General

Basic Strings, Fresh eyes please.

(1/3) > >>

commodianus:

--- Code: ---
ArtName := Copy(CurArt,Pos('">',CurArt)+2, Length(CurArt)-Pos('</a>',CurArt)+6);

 
--- End code ---

Artname, if it helps, will look like this:


--- Code: ---<li><a href="index.cfm?id=37237">ZOCE, OUR LADY OF</a></li>
--- End code ---

Though naturally, the link text changes.

The code worked, I thought, except if the link text is >9 characters (cutts it off there). Suggestions? I think there's got to be a better way to deal with the last param.

eny:
Use regular expressions for this.

dfeher:
Try this:


--- Code: ---ArtName := RightStr(CurArt, Length(CurArt) - Pos('">', CurArt) + 1);
ArtName := LeftStr(ArtName, Pos('</a>', ArtName));

--- End code ---

I hope this works.

theo:
Copy does not work like
Copy(String, FromPosition, ToPosition) but like
Copy(String, FromPosition, Count).

commodianus:

--- Quote from: theo on April 02, 2010, 09:12:40 pm ---Copy does not work like
Copy(String, FromPosition, ToPosition) but like
Copy(String, FromPosition, Count).


--- End quote ---

Yeah I guess what I was trying to do is get the count based on where </a> was.

Navigation

[0] Message Index

[#] Next page

Go to full version