left characters of a string
Mostra commenti meno recenti
if I have a name 'Microsoft', how can i get the first 6 characters 'Micros'?
Risposta accettata
Più risposte (1)
This wasn't an option when the question was originally asked, but the extractBefore function will work for both char vectors and string arrays.
c = 'Microsoft'
c6 = extractBefore(c, 7)
s = string(c)
s6 = extractBefore(s, 7)
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!