Replace specific elements in strings
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a quaestion. Which command should I use in order to replace () with -.
for example I have strigs in an array like :
America (New York)
America (Manhattan)
Italy (Rome)
And I would like my output strings to be:
America - New York
America - Manhattan
Italy - Rome
Which command shouls I use? I tried strrep but no use.
Could you please help me?
1 comentario
chrisw23
el 6 de Mzo. de 2023
repStr = string("America (New York)").replace(" ("," - ").replace(")","")
one of many options
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!