[AccessD] Parsing String

Reuben Cummings reuben at gfconsultants.com
Thu Jan 13 15:08:37 CST 2005


lngCutOff = InStrrev(strWhatever," ",53)
strFirstLine = trim(left(strWhatever,lngCutOff))
strSecondLine = trim(right(strWhatever,len(strWhatever)-lngCutOff))

Reuben Cummings
GFC, LLC
phone: 812.523.1017
email: reuben at gfconsultants.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mitsules, Mark
Sent: Thursday, January 13, 2005 3:42 PM
To: [AccessD]
Subject: [AccessD] Parsing String


Group,

I have a large recordset of strings that need to be split up by length,
maximum of 53 characters per line, not to exceed 2 lines.  The issue I am
struggling with is maintaining logical word breaks.  For instance, here is
an example string (watch for line wrap):

VENTILATION CONNECTION UNDER 1ST, 2ND & 3RD PLATFORM, FR 37-39 - HANGER
DETAILS MANUFACTURING

Can anyone suggest a good routine to accomplish this?  Here are my first
thoughts...  I would like to take any line over 40 characters and split it
into 2 lines, so the pseudocode might be something like:

If len(strTitle) > 40, Then
 starting point is at the halfway point
 If at a space, then
  make the break here
 Else
  count number of characters forward to a space
  count number of characters backward to a space
  make the break at the lower of the two
 End If
End If


Thanks for any suggestions.


Mark
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com







More information about the AccessD mailing list