首页 > 其他专区 > Access >

Access字符串去除重复字符

Access 2021-06-25

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

​代码:

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

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

演 示:

字符串去除重复字符

Copyright © 2016-2023 office学习教程网 office.tqzw.net.cn. All Rights Reserved.