Free Support Forum - aspose.com

Request - pattern.IsICalString(string)?

I’m using a database which may or may not contain an icalendar string
in a given field, and if it does, then one process occurs, otherwise,
it is treated as something else entirely.



I need a way to test whether a string is a valid ICal string, can this be done?



Cheers



Tristan Rhodes

Here is a workaround I can recommend:

try

{

RecurrencePattern pattern = new RecurrencePattern(string);

// if loaded successfully, the string is an iCalendar string.

}

catch (Exception e)

{

//if exception was thrown, the string is invalid.

}

This is the solution i am currently using, however, exceptions are
increadably expensive to handle, and i’d rather manage it another way
using some form of validation.



Cheers



Tris