Access字符串去除重复字符

【Access字符串去除重复字符】分享给互联网技能从业者学习和参考。

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

?代码:

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字符串去除重复字符