write a code to sort string
조회 수: 14(최근 30일)
표시 이전 댓글
how to I write a code for this problem:
Write a program that accepts a string from a user with the input function, chops that string into a series of tokens, sorts the tokens into ascending order, and prints them out.
this is what I wrote so far I dont know what to do
%Input a user string
str=input('Enter string:','s');
[token,remain]=strtok(str,',')
답변(1개)
ANKUR KUMAR
2021년 3월 17일
str=input('Enter string:','s');
strsplit(str,',')
On which basis you wish to sort strings? Is it alphabatically, or based on the length ?
참고 항목
범주
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!