$replacefull

By QuickStep on Aug 18, 2005

Keeps on replacing untill there is nothing more to replace

;Usage: works just like $replace , the only difference is it will keep on replacing untill there is nothing more to replace

;Examples:

;$replacefull(3----5+++++++3-+-----+++2,++,+,--,+,+-,-,-+,-)
;returns: 3+5+3+2

;$replacefull(aaaaaaaaaaaaaaaa,aa,a).cs
;returns: a
;NOTE that .cs is the case-sensitive version

alias replacefull {
  var %a = $1, %b, %c, %d = 2
  ;Construct replace
  while (%d <= $0) {
    %c = $+(%c,$chr(44),$eval($+($,%d),2))
    inc %d
  }
  ;Loop through replace
  while (%a != %b) {
    %b = %a
    %a = $eval($+($eval($replace,0),$prop,$chr(40),%a,%c,$chr(41)),2)
  }
  return %a
}

Comments

Sign in to comment.
DeathRyder082   -  Aug 21, 2005

Again, looks good.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.