jeudi 27 mai 2010

Given a string, remove all chars from the string that are present in say another string called filter


solution 1: advantage is that we do not duplicate the string
k = 0
while s[i] <> 0
found = 0
for j = 0 ; j < sFilter ; j++
if s[i] == filter[j]
found = 1
break
if ! found
s[k++] = s[i]
i++
s[k] = 0

Aucun commentaire:

Enregistrer un commentaire