English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Actually i am storing this formatting text as HTML into a databse field of Text data type.now i am facing problem in display this text.
i have to show all formatting text on another page. but if length of text is greater than 600 characters, then a link (more ) should be display , and when user clicks on link full html text will be display on page. but the problem is i can not simply use substring to cut the string, becase text is stored with Html tags
for example user enters text="I am a man" then it will be stored as "

i am a man

", so if i want to display only 10 charcters then substring will return ="

i am a " , please help me

2006-08-02 00:38:06 · 1 answers · asked by googsoft 1 in Computers & Internet Programming & Design

1 answers

You need to use two loops for this. Algorithm kind of solution is:

Dim x as string
dim r as int (r = )
dim i as int (loop counter)
dim h as int (html tag counter)
while i is not equal to r
get a char from input string
if it is a < char (starting HTML Tag)
while h is not equal to length of string
check the char found. If it is >, exit from the loop
increment h
end of inner while loop
end if
add the char to x
get next char
increment i
while ends here
Return x.

2006-08-02 02:22:28 · answer #1 · answered by Indian_Male 4 · 1 0

fedest.com, questions and answers