/    Sign up×
Community /Pin to ProfileBookmark

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 – [url]http://polestar.lbclients.co.uk/[/url] (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>”
[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 31.2010 — [CODE]str.match(/.{120,130}(?= )/gi);[/CODE]
×

Success!

Help @scoops13 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...