How to get rid of duplicated characters in a string - page 2

 
babigaf:

dude!! reading your code worth an entire class to me!! that was incredible and worked well. as you guessed, I tried it in RTL too and it works as awesome as it does in LTR. 

thanks man. I appreciate your time.

No problem :)

 

even shorter:

string StringRemoveDuplicates(string source)
  {
   for (int n=0;n<StringLen(source)-1;n++)
     {
      while (StringFind(source,StringSubstr(source,n,1),n+1)!=-1)
        {source=StringSubstr(source,0,n)+StringSubstr(source,n+1);}
     }
   return source;
  }
 
babigaf:
well alain. you are always in help. for a better solution, what do I need to compare two characters? can you help me out?

In the meantime I think you get enough answers from others ;-)

May I ask what is the use case for this ? Why do you need to remove duplicate characters from a string ?

 
Alain Verleyen:

In the meantime I think you get enough answers from others ;-)

May I ask what is the use case for this ? Why do you need to remove duplicate characters from a string ?

it might sound a little silly but... well I happen to know some astrologists and they came with an idea about the probability of using their knowledge in trade. 

it is a free run and I am following their instructions to put their strategy in test. 

 
hence the lunar calendar ?
 
Chris70:

even shorter:

:D

you guys would never stop amazing me right??!
:D


this experience was so sweet to me that  I would start to randomly ask some questions just to see you guys coming with awesome solutions. it is a complete class and opportunity of learning for me.

 
Lorentzos Roussos:
hence the lunar calendar ?

exactly.

and even RTL letters. I am almost in middle of the work and it is about 1000 line of code already :D

 
Well done .+ Interesting 
 
Lorentzos Roussos:
Well done .+ Interesting 

Thanks brother.

your guide was a splendid help to me ^__^

 
babigaf:

Thanks brother.

your guide was a splendid help to me ^__^

Actually, I am wondering what is the exact specification you want.

Because the code provided by @Chris70 is bugged (for sure).

And the one provided by @Lorentzos Roussos maybe too

 TEST 1 : ahjzhhhz8128 => ajhz128 (Chris) : ahjz812 (Lorentzos)

Files:
327126.mq5  3 kb