Problem converting block of string to clipboard when there is ^ character in rebol
Let's say I have this block:
Yuml-Output-List: [ {note: Wordpress Profiles{bg:beige}
[Blogger]^[User]
[Admin]^[Blogger]
[Author]^[Blogger]
[Subscriber]^[User]
}
{note: Blogger Role{bg:b开发者_JAVA百科eige}
[Blogger]-(Manage Posts)
}
{note: Admin Roles{bg:beige}
[Admin]-(Manage Site)
(Manage Site)>(Manage Users)
(Manage Site)>(Manage Themes)
(Manage Site)>(Manage Plugins)
}
]
If I want to copy the result to the clipboard with this:
clipboard: copy ""
foreach element Yuml-Output-List [
append clipboard element
append clipboard newline
append clipboard newline
]
write clipboard:// clipboard
I get ESC character INSTEAD of ^:
note: Wordpress Profiles{bg:beige}
[Blogger]ESCUser]
[Admin]ESCBlogger]
[Author]ESCBlogger]
[Subscriber]ESCUser]
note: Blogger Role{bg:beige}
[Blogger]-(Manage Posts)
note: Admin Roles{bg:beige}
[Admin]-(Manage Site)
(Manage Site)>(Manage Users)
(Manage Site)>(Manage Themes)
(Manage Site)>(Manage Plugins)
So how to get rid of the escape output ?
Since this is a REBOL string, the ^[ represents an ESC char as the ^ is used for escape sequences.
So, what you want to do is replace your existing ESC char with a caret and a left bracket like this:
replace/all source "^[" "^^["
Note the ^^ as you need to escape the ^, and the left bracket is now no longer escaped.
精彩评论