;老师们,如果我选中一段英文文本,我想按一个键,比如F1, 这段文本词的顺序随机排,但属于短语的不拆开。
;比如: Living Room Balcony Christmas Day New Year
;随机重拍后顺序可能变成了
;New Year Balcony Christmas Day Living Room 
;(New Year,Living Room,  Christmas Day这样的不拆开)
;这个怎么用ahk 实现

str=
(
There are moments in life when you miss someone so much that you just want to pick them from your dreams and hug them for real! Dream what you want to dream.
go where you want to go.
be what you want to be,because you have only one life and one chance to do all the things you want to do.
)

; str=Living Room Balcony Christmas Day New Year Game Over

不可分词组:={"Christmas Day":"ChristmasDay","New Year":"NewYear","Living Room":"LivingRoom"}

For k, v in 不可分词组
  str:=StrReplace(str, k, v)

; 根据空格区分单词并换位置
Sort, str, Random D%A_Space%

for k, v in 不可分词组
  str:=StrReplace(str, v, k)

MsgBox % str

; 反过来的不可分词组:={"ChristmasDay":"Christmas Day","NewYear":"New Year","LivingRoom":"Living Room"}
  
; for k, v in 反过来的不可分词组
;   str:=StrReplace(str, k, v)

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。