I guess I'm just thick-headed today but I can't think of a good and fast way
to add the following line to the previous line without loading the entire file
as a blob instead of as a line input.
A typical series of lines looks like this:
BEGIN:VEVENT
SUMMARY:Emancipation Proclamation
UID:2008-05-08-...@americanhistorycalendar.com
SEQUENCE:0
RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=1;BYMONTHDAY=1
DTSTART;VALUE=DATE:20080101
DTEND;VALUE=DATE:20080102
CATEGORIES:Civil War Events
LOCATION:Washington, D.C.
DESCRIPTION:On January 1\, 1863 Abraham Lincoln issues the Emancipation Pr
oclamation\, freeing slaves in Confederate-held territory.\n\n\nhttp://Amer
icanHistoryCalendar.com
URL:index.php?option=com_zcalendar&task=view&vmode=e&eid=910
END:VEVENT
BEGIN:VEVENT
SUMMARY:Georgia\, the fourth state
UID:2008-05-02-...@americanhistorycalendar.com
SEQUENCE:0
etc.
Note how the Description field is multi-line. I want to add succeeding lines
to the first but for the life of me I can't can't figure out a good way of
doing it.
> This is dumb. I'm trying to think of a way to parse continued lines in a
> VCalendar file. The only indication that a line such as a description or a
> summary continues on the next line is that the next line begins with a space.
> BEGIN:VEVENT
> SUMMARY:Emancipation Proclamation
> UID:2008-05-08-...@americanhistorycalendar.com
> SEQUENCE:0
> RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=1;BYMONTHDAY=1
> DTSTART;VALUE=DATE:20080101
> DTEND;VALUE=DATE:20080102
> CATEGORIES:Civil War Events
> LOCATION:Washington, D.C.
> DESCRIPTION:On January 1\, 1863 Abraham Lincoln issues the Emancipation Pr
> oclamation\, freeing slaves in Confederate-held territory.\n\n\nhttp://Amer
> icanHistoryCalendar.com
> URL:index.php?option=com_zcalendar&task=view&vmode=e&eid=910
> END:VEVENT
With line input, you're going to have to keep track of "where" you are
(which named entry you loaded last) and append any continuation line(s)
onto that.
Line Input sLine, ...
If IsContinuation(sLine) Then
if sCurrentlyLoading = "DESCRIPTION" Then
AppendToDescription( sLine )
Elseif sCurrentlyLoading = "SUMMARY" Then
AppendToSummary( sLine )
. . .
End if
Else
sCurrentlyLoading = Split( sLine, ":")(0)
End if
If you /can/ load the whole thing (even just a VEvent at a time) into a
single string, then ...
stringData = Replace( stringData, vbCrlf & " ", "" )
... will do the job nicely.
HTH,
Phill W.
> I guess I'm just thick-headed today but I can't think of a good and fast
> way
> to add the following line to the previous line without loading the entire
> file
> as a blob instead of as a line input.
Are you expecting multi-megabyte vCalendar files? If not, bring it all in at
once!
>Are you expecting multi-megabyte vCalendar files? If not, bring it all in at
>once!
Yeah, I guess you're right. I'll rework it.