Results 1 to 5 of 5

Thread: Limit number of displayed characters while maintaining bold and italic formatting in ASP

  1. #1
    Join Date
    Jan 2011
    Posts
    7

    Limit number of displayed characters while maintaining bold and italic formatting in ASP

    Help me to solve a problem with a function? I am new on this forum, and I have observed that you members really help good with proper information that too very fast. So, I am continuing to ask for some more help. I am now having some issues in ASP. What I get is something very similar to the operation of this forum but with an added difficulty that I can not overcome. In a textarea (just like this of this writing) a user enters the text (this is a description of a possible offer service) immediately after submitting the form. The text is stored in a db and then at the appropriate time extracted and shown on the main page of the site in the right place. Its good so far. I like to give the user the ability to set only a few tags to format text in bold for instance, should write [g] xxxxx [/g] for italics and write [c] xxxx [/c] for bold. Unfortunately, since the space available, where to show the offer is limited, I used a function that removes all the various "tags" in the text set, do I count the number of remaining characters and it would simply amount to a number. I have limited the number of characters allowed to 50, which then would be added to the usual ellipsis, pseudo tag [c] be always open, disrupting the entire format of the site. The main thing is that I want to limit number of displayed characters while maintaining bold and italic formatting in my program. Can anyone help me to solve this problem?

  2. #2
    Join Date
    Oct 2008
    Posts
    100

    Re: Limit number of displayed characters while maintaining bold and italic formatting in ASP

    Have you tried to put all that is over 50 non-print it out and put [/c]. I think that will help you. And after that you will have to detect the last pseudo-tags that the user was using. For that find the last letter contains a check that after the 50 character and put [/ + the last part of the tag open. For example :
    Code:
    [G] hello 
    
    search for [ 
    The following is a Carratta g 
    
    the closing tag is [/+g] or [/g]
    I think that you should have understand this. (Great question, difficult to solve such queries... )

  3. #3
    Join Date
    Apr 2009
    Posts
    68

    Re: Limit number of displayed characters while maintaining bold and italic formatting in ASP

    However for me all these problems may not for the closing tag. That's what I think. This is really tough to solve. I would like to suggest you to replace all tags with the relevant html and before inserting the 3 dots fill in all the expected closing tag. Maybe you think this as waste, but try once before ignoring it (might work). Like
    HTML Code:
    <body>
     hello <em> like </em> is </em> </strong> ...
     </Body>

  4. #4
    Join Date
    Jan 2011
    Posts
    7

    Re: Limit number of displayed characters while maintaining bold and italic formatting in ASP

    Thanks for your help.. The latter hypothesis that I propose unfortunately does not go in as soon as all the code there are other open tags in bulk and then closing the previous close tags and the structure of the site totally blows. I would choose to follow your earlier suggestion mentioned by "Broot". [INDENT]For that find the last letter contains a check that after the 50 character and put [/ + the last part of the tag open. For example :

    Code:
    [G] hello
    
        search for [
        The following is a Carratta g
    
        the closing tag is [/+g] or [/g]
    But I was not able to understand what you mean by "find the last [check that ....]. I do not understand how can I do it.?!! So please continue to help.

  5. #5
    Join Date
    Apr 2009
    Posts
    105

    Re: Limit number of displayed characters while maintaining bold and italic formatting in ASP

    Try the first "[" using instr () result 6. Then print the first 5 characters or "hello", then remove the text of the first 5 characters.
    text = right (text, len (text) -5) or "[b] [g] as [/g] is [c]?"
    now checks the value of the second character (you know the first is a [) if it is a "/" marks the error otherwise you will have the tag open. circles and its closing tag (in this case does not exist) if there is a closing tag (tag = "[/ b]") and dies on the html tag open. redo the procedure and when you try on the close tag (using instr ()) and find it will result in 8. so you have to take the text content between 4 (the first 3 are the opening tag) and 7 (8 starts the closing tag) and printed with html tags. hours to eliminate the print + characters opening and closing tag (respectively 3 and 4) then a total of 11 characters (function right ()). Prints the HTML tag on and take out the 3 characters from the text variable that you have left. Splitting the variable tag and closing tag for each die on the html tag. Finally, the three dots, remove it.

Similar Threads

  1. Blackberry Bold 9900 have SMS saving Limit
    By Shurod in forum Portable Devices
    Replies: 5
    Last Post: 18-08-2011, 11:17 PM
  2. Replies: 5
    Last Post: 25-12-2010, 07:44 PM
  3. Office 2007 find/replace formatting characters
    By NickCanuck in forum Windows Software
    Replies: 4
    Last Post: 07-08-2010, 06:30 PM
  4. Special characters are not displayed in Word
    By Pyrotechnic in forum Windows Software
    Replies: 2
    Last Post: 10-09-2008, 05:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,555,390.05088 seconds with 17 queries