![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi all, I need to strip all punctation out of an alpha field leaving just the the a-z, A-Z, and 0 - 9 characters. Can this be done via a QBE or SQL Query ? and if so can anyone give an example Thanks Leslie. |
#3
| |||
| |||
|
|
I suspect you'd have to use code (e.g. breakApart). Maybe SQL can do it, but I can't think of how. QBE definitely cannot. Liz |
#4
| |||
| |||
|
|
Hi all, I need to strip all punctation out of an alpha field leaving just the the a-z, A-Z, and 0 - 9 characters. Can this be done via a QBE or SQL Query ? and if so can anyone give an example Thanks Leslie. |
#5
| |||
| |||
|
|
Leslie - Be carefull what you wish for. Are you absolutely sure you want to get rid of all spaces, puncuation and formating as well? No matter what the desired valid characters are - it seems like every character must be tested. Assuming you can set up tcursor'ing through your table, the meat (untested) is provided below. Ed strValid = "0123456789abcd.." ; fully enumerate desireable characters (open / edit tcursor) ...(start loop to move thru table 1 record at a time) strIn = tcD."FieldName" ; field to be stripped strOut = "" for i from 1 to strIn.size() strX = strIn.substr(i,1) if strValid.search(strX) > 0 then ; Valid character strOut = strOut + strX endif endfor tcD."FieldName" = strOut tcD.postrecord() ... end loop ( & cleanup) |
#6
| |||
| |||
|
|
Leslie - Be carefull what you wish for. Are you absolutely sure you want to get rid of all spaces, puncuation and formating as well? No matter what the desired valid characters are - it seems like every character must be tested. Assuming you can set up tcursor'ing through your table, the meat (untested) is provided below. Ed |
#7
| |||
| |||
|
|
Actually, you can use breakApart |
|
Ed, Actually, you can use breakApart (assuming you know all the possible invalid chars): stBreak = "~`!@#$%^&*()_+-=[]{}\\|;:'\",./<>? " ;// backslash and double quote are escaped stFixMe.breakApart(ar,stBreak) stFixed.blank() for li from 1 to ar.size() stFixed = stFixed + ar[li] endFor ...if you don't know all the possible invalids, then you'd have to do like you described. Liz Ed Covney wrote: Leslie - Be carefull what you wish for. Are you absolutely sure you want to get rid of all spaces, puncuation and formating as well? No matter what the desired valid characters are - it seems like every character must be tested. Assuming you can set up tcursor'ing through your table, the meat (untested) is provided below. Ed strValid = "0123456789abcd.." ; fully enumerate desireable characters (open / edit tcursor) ...(start loop to move thru table 1 record at a time) strIn = tcD."FieldName" ; field to be stripped strOut = "" for i from 1 to strIn.size() strX = strIn.substr(i,1) if strValid.search(strX) > 0 then ; Valid character strOut = strOut + strX endif endfor tcD."FieldName" = strOut tcD.postrecord() ... end loop ( & cleanup) |
#8
| |||
| |||
|
|
The need is due to the fact that the fields in question are free format phone number fields and we want to do a partial match. So things like ()[] and spaces will be an issue due to the inconsistency of data entry. What is really a surprise is that in Australia there is no standard on the format of phone number fields, |
#9
| |||
| |||
|
|
The need is due to the fact that the fields in question are free format phone number fields and we want to do a partial match. So things like ()[] and spaces will be an issue due to the inconsistency of data entry. What is really a surprise is that in Australia there is no standard on the format of phone number fields, so of course every company uses any gimmick they want. I say surprise because in this day and age, I would have expected there to be a standard (or a couple to choose from) just like dates. Thanks Leslie |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |