Ditto
Ditto copied to clipboard
ChaiScript SetAsciiString not setting clip
I have input like last, first m
and I want to convert it to first m last
. So I am trying to use regex to extract the various parts and put it together but it's not returning the output I would expect.
var original = clip.GetAsciiString();
clip.AsciiTextReplaceRegex(",.*$", "");
var lastPart = clip.GetAsciiString();
clip.SetAsciiString(original);
clip.AsciiTextReplaceRegex("^.*?,", "");
var firstPart = clip.GetAsciiString();
var together = firstPart + " " + lastPart;
clip.SetAsciiString(together);
return false
- get the clip
- replace the first comma and everything after it
- save this string
- set clip back to original string
- replace everything up to the first comma
- save this string
- put the two strings together
- set the clip to the new string
But in my sample input test, it does not output anything.