www.webdeveloper.com
Results 1 to 2 of 2

Thread: I have 3 stringS (news feed) of text which I want to search using loop function...

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    1

    I have 3 stringS (news feed) of text which I want to search using loop function...

    I have 3 stringS (news feed) of text which I want to search for the next available space using the loop function, but it needs to search only between a specific start and finish point, charectuer 120 to 130, and then display this on the page... some of the code I have already done below.

    At the moment it is just cutting it off at charecteur 130 and then adding ..., but this cuts it off mid word in aqnother sentance.

    How do I do this?

    3 strings of text:

    BMJ Group has awarded Polestar Chantry with a new 3-year contract for the print, binding and mailing of their portfolio of weekly flagship titles; BMJ and BMANews.

    Polestar Sheffield is proud to announce having won this year’s ERA European Publication Gravure Award for printing on improved newsprint.

    National Magazine Company has awarded Polestar Colchester a 2 year contract for the print and subscription mailing of Best magazine.

    website - http://polestar.lbclients.co.uk/ (news feed - bottom left)

    Code:
            JScript &= "<script type=""text/javascript"">" & vbCrLf
            JScript &= "var news = new Array(" & vbCrLf
    
    
    
            While i < count
                n = nodelist(i)
    
                Dim newsdesciption As String = getAttribValue("description", n)
    
    	
    		'CODE GOES HERE
    
    
                JScript &= """" & Server.HtmlDecode(getAttribValue("link", n)).ToString & ":::" & TrimString(newsdesciption, 130) & "..."
                i += 1
                If i < count Then JScript &= """," Else JScript &= """"
            End While
    
            JScript &= ")" & vbCrLf
            JScript &= "</script>"

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    str.match(/.{120,130}(?= )/gi);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles