Let's say I have the following:
['cart', 'horse']
Is there a quick way to swap the two so I have the following:
['horse', 'cart']
I'm referring to the actual text a开发者_JAVA百科nd not reordering an array programmatically. For example, I usually do something like this:
- Highlight and cut " 'horse'"
- Delete the trailing comma
- Paste " 'horse'" before "'cart'"
- Delete the leading space
- Add ", " after "'horse'"
I find myself needing to do this type of thing frequently, so I'm wondering if TextMate has some type of built-in functionality/bundle for accomplishing this.
Thanks.
When I have to do something like this, I will use regular expressions in the Search & Replace dialog.
Search for: '(.*)', '(.*)'
Replace with: '$2', '$1'
And make sure that the "Regular Expression" box is ticked. There may be a bundle that can help out with this, but I often find it easier to write a quick regex to reorder/rearrange.
精彩评论