mathematica处理字符串
1、首先,给出一个甜入艺阝句子a:a="The eagle flies in the vast sky,the fish swim in th髫潋啜缅e clear water,and all things are in the light of autumn to live a free life.";
2、对字符串强制换行:InsertLinebreaks[a,36]
3、按照空格,把句子分解为单词:b=StringSplit[a]
4、在单词的左面填充0,使得每个单词的长度为20:c=StringPadLeft[b,20,"0"];
5、在右侧填充单词:d=StringPadRight[b,20,"^o._"];
6、用“___”把单词两两连接,并换行:StringRiffle[Partition[水瑞侮瑜b,2] ,"\n","___"]
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:26
阅读量:71
阅读量:75
阅读量:50
阅读量:47