Coding to check for duplicate character in a string

  • Thread starter Benjamins via AccessMonster.com
  • Start date
B

Benjamins via AccessMonster.com

Hi,

Is there a way for me to check whether is there any duplicate character in a
string.

Example
User Entry Result
"12345" No Duplicate
"ABCDE" No Duplicate
"AACDE" Duplicate
"12341" Duplicate

Thanks
 
A

Alex Dybenko

Hi,
air code to explain the idea:

str="AACDE"
strresult ="No Duplicate"
for I = 1 to len(str)
if instr(0,left(str,I-1) & mid(str, I+1), mid(str, I,1))>0 then
strresult ="Duplicate"
exit for
end if
next I


--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top