首页 » office教程 » Access

Access字符串去除重复字符

Access 2021-12-07

现有一串字符中有多个重复的字符,需要将重复的字符去除,只保留一个不重复的字符。

代码:

Public Function MoveSame(strSame) As String

Dim s As String, i As Long

s = strSame

i = 1

Do While i < Len(s)

s = Left(s, i) & Replace(s, Mid(s, i, 1), "", i + 1)

i = i + 1

Loop

MoveSame = s

End Function

示例下载:(在“了解更多”里下载)

演 示:

Access字符串去除重复字符


上一篇:没有了下一篇:Access 如何在记录行之间进行统计计算
程序园_程序员的世界 Copyright © 2020- www.580doc.com. Some Rights Reserved.