ASP Format Function
This function operates similarly to the VB Format function with one big exception. The "#" character is used to represent any single character. You can trim all non alphanumeric characters out and reformat them to stay consistant. Usefull for credit cards, zipcodes, phone numbers, etc...
AI
AIサマリー: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ソースコード
'******
'** Formats a string to include standard sets.
'**
'** Example: Format("1234567890", "(###) ###-####")
'** Result = (123) 456-7890
'** Modified 01/09/03 to allow extended format mask that will
'** not return extra ###'s brian reeves
'******
Public Function Format(sValue, sMask)
Dim iPlaceHolder
Dim sTempValue
Dim sResult
sTempValue = CStr(sValue)
sResult = sMask
Do Until InStr(sResult, "#") = 0
iPlaceHolder = InStr(sResult, "#")
sResult = Replace(sResult, "#", Left(sTempValue, 1), 1, 1)
sTempValue = Mid(sTempValue, 2)
If Len(sTempValue) = 0 Then sResult = Left(sResult, iPlaceHolder)
Loop
Format = sResult
End Function
Upload
オリジナルのコメント (3)
Wayback Machineから復元