jwcolby
jwcolby at colbyconsulting.com
Thu Sep 27 13:59:38 CDT 2007
LOL, well, that is certainly an option. In fact I am currently doing something similar and realized that I had done a simple substitution. However... I am also getting things like APN SEQUENCE NUMBER. I really want to remove the space and camel case what is left. ApnSequenceNumber. Of course this ignores that APN is an acronym but I cannot really know that. These field names come at me from all angles and I just want to standardize the results so that my tables have readable field names. I am hearing about RegEx, in fact from our group members, so I thought perhaps someone either already had this laying around, or at least had the familiarity to knock one out and explain it. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of max.wanadoo at gmail.com Sent: Thursday, September 27, 2007 2:47 PM To: dba-vb at databaseadvisors.com; 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com Subject: Re: [dba-VB] Use Regex - Create Camel Case John, Why not just poke the string into a function - at least it is understandable/readable. (Aircode) Public function pfDropBadChars(str2Parse as string) as string const conBadChars as string = "!"£$%^" Dim lng as long,strTemp as string For lng = 1 to len(str2Parse) If instr(mid(str2Parse,lng,1),conBadChars) = 0 then ' or is this the otherway around - can't remember! strTemp=strTemp & mid(str2Parse,lng,1 Endif Next lng pfDropBadChars=strtemp End function Max -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Thursday, September 27, 2007 7:34 PM To: 'Access Developers discussion and problem solving'; dba-sqlserver at databaseadvisors.com; VBA Subject: [dba-VB] Use Regex - Create Camel Case Folks, I am looking for a regex expression (preferably with explanation) for taking an expression and creating a camel case (or PascalCase) expression. I get CSV files with headers in them. All too often the eejits that created the databases they came from used embedded spaces or other special use characters (!@#$%^&* etc) in their field names. I need to strip these special characters out completely. I also need to upper case the valid alpha character that follows any of these special characters. John colby becomes JohnColby %idiotic_Field*name becomes IdioticFieldName Etc. It appears that Regex is the key (I am doing this in VB.Net) but until today I have never really tried to use RegEx and it ain't pretty! Any help in this would be much appreciated. John W. Colby Colby Consulting www.ColbyConsulting.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com