how to delete the dot in a string
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
like bbc.ed.123.f.txt how to change it to bbced123f.txt
0 commentaires
Réponse acceptée
Andrei Bobrov
le 21 Jan 2014
Modifié(e) : Andrei Bobrov
le 21 Jan 2014
a = 'bbc.ed.123.f.txt';
regexprep(a,{'\.','txt'},{'','.txt'})
or
[strrep(a(1:end-4),'.',''),'.txt']
Plus de réponses (1)
ES
le 21 Jan 2014
you have to handle the last dot(before file extension) and the other dots separately.
str='bbc.ed.123.f.txt';
idx=strfind(str,'.');
new_str=[strrep(str(1:idx(end)-1),'.',''),str(idx(end):end)];%idx(end) is the position of the last dot!
0 commentaires
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!