首页 > 其他专区 > Access >

Access字符串去除重复字符

Access 2021-09-18 09:08:38

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

​代码:

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

office教程网 Copyright © 2016-2020 https://www.office9.cn. Some Rights Reserved.