Elegant way to distinct Path or Entry key

Posted by sum1stolemyname on Stack Overflow See other posts from Stack Overflow or by sum1stolemyname
Published on 2010-06-14T14:22:05Z Indexed on 2010/06/14 14:42 UTC
Read the original article Hit count: 146

Filed under:
|

I have an application loading CAD data (Custom format), either from the local filesystem specifing an absolute path to a drawing or from a database.

Database access is realized through a library function taking the drawings identifier as a parameter.

the identifiers have a format like ABC 01234T56-T, while my paths a typical windows Paths (eg x:\Data\cadfiles\cadfile001.bin).

I would like to write a wrapper function Taking a String as an argument which can be either a path or an identifier which calls the appropriate functions to load my data.

Like this:

Function CadLoader(nameOrPath : String):TCadData;

My Question: How can I elegantly decide wether my string is an idnetifier or a Path to a file? Use A regexp? Or just search for '\' and ':', which are not appearing in the Identifiers?

© Stack Overflow or respective owner

Related posts about regex

Related posts about delphi