max.wanadoo at gmail.com
max.wanadoo at gmail.com
Thu Sep 27 14:39:57 CDT 2007
John, Or flip it viz: Function dbc() MsgBox pfGetGoodChars("APN SEQUENCE #$%NUMBER") End Function Public Function pfGetGoodChars(str2Parse As String) As String Const conGoodChars As String = "abcdefghijklmnopqrstuvwxyz" ' valid characters Const conQuote As String = """" Dim lng As Long, strTemp As String, bFlipCase As Boolean str2Parse = UCase(Left(str2Parse, 1)) & LCase(Mid(str2Parse, 2)) For lng = 1 To Len(str2Parse) If InStr(conGoodChars, Mid(str2Parse, lng, 1)) > 0 Then If bFlipCase = True Then strTemp = strTemp & UCase(Mid(str2Parse, lng, 1)) bFlipCase = False Else strTemp = strTemp & Mid(str2Parse, lng, 1) End If Else bFlipCase = True End If Next lng pfGetGoodChars = strTemp End Function -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-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: [AccessD] 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com