Ditto icon indicating copy to clipboard operation
Ditto copied to clipboard

ChaiScript SetAsciiString not setting clip

Open imthenachoman opened this issue 5 months ago • 0 comments

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
  1. get the clip
  2. replace the first comma and everything after it
  3. save this string
  4. set clip back to original string
  5. replace everything up to the first comma
  6. save this string
  7. put the two strings together
  8. set the clip to the new string

But in my sample input test, it does not output anything.

image

imthenachoman avatar Sep 12 '24 18:09 imthenachoman