access其最大的优点是:简单易学!非计算机专业的人员,也能学会。所以用它作为数据库的入门来学习是非常不错的选择。本文主要讲诉怎样一步步搭建一个小型的ACCESS数据库今天在确认实习......
Replace函数
Function fstrTran(ByVal sInString As String, _
sFindString As String, _
sReplaceString As String) As String
Dim iSpot As Integer, iCtr As Integer
Dim iCount As Integer
iCount = Len(sInString)
For iCtr = 1 To iCount
iSpot = InStr(1, sInString, sFindString)
If iSpot > 0 Then
sInString = Left(sInString, iSpot - 1) & _
sReplaceString & _
Mid(sInString, iSpot + Len(sFindString))
Else
Exit For
End If
Next
fstrTran = sInString
End Function
tmtony在 2002/04/08 18:24:00 回复-------------------
我也有个例子,在
http://www.office-cn.net/bbs/dispbbs.asp?boardID=3&RootID=1329&ID=1388
里用到.不过也是借用的
Function ReplaceStr(TextIn, SearchStr, Replacement, CompMode As Integer)
Dim WorkText As String, Pointer As Integer
If IsNull(TextIn) Then
ReplaceStr = Null
Else
WorkText = TextIn
Pointer = InStr(1, WorkText, SearchStr, CompMode)
Do While Pointer > 0
WorkText = Left(WorkText, Pointer - 1) & Replacement & Mid(WorkText, Pointer + Len(SearchStr))
Pointer = InStr(Pointer + Len(Replacement), WorkText, SearchStr, CompMode)
Loop
ReplaceStr = WorkText
End If
End Function
大熊在 2002/04/08 18:41:00 回复-------------------
好像基本一样啊,只是觉得你的函数名更好记,但是变量命名就没此人来的规范,可读性也要差一些!两者合并以后,归我用啦!:)
Ps.加个CompMode也很实用。
标签: Replace函数
相关文章
- 详细阅读
- 详细阅读
- 详细阅读
-
Access2016数据库开发教程1详细阅读
第一章开发平台概述1.1盟威软件快速开发平台是什么?1.1.1概述《盟威软件快速开发平台(Access版)》是一款免费的快速开发平台。该平台主要用于企业中各种管理信息系统的开发,不会编程的......
2022-04-19 488 Access Access2016 Access2016数据库开发 数据库开发
- 详细阅读