Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to match all double byte characters
#29
Good idea. Code works well

@kevin
Using #10 code, there are still replacement errors, which seems a little difficult


[Image: abc.gif]

Macro Macro9
Trigger A5     Help - how to add the trigger to the macro
Code:
Copy      Help
_s=
;class Program
;{
;,static void Main()
;,{
;,,ComponentInfo.SetLicense("FREE-LIMITED-KEY");
;
;,,DocumentModel document = new DocumentModel();
;
;,,Section section = new Section(document);
;,,document.Sections.Add(section);
;
;,,Paragraph paragraph = new Paragraph(文件);
;,,section.Blocks.Add(paragraph);
;
;,,Run run = new Run(document, "文字");
;,,paragraph.Inlines.Add(run);
;
;,,document.Save("文件名.docx");
;,}
;}

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54030080 0x200 8 8 96 12 ""
;4 Edit 0x54030080 0x200 8 28 96 13 ""
;5 Edit 0x54030080 0x200 8 48 96 12 ""
;6 Edit 0x54030080 0x200 8 68 96 13 ""
;7 Edit 0x54030080 0x200 8 88 96 12 ""
;8 Edit 0x54030080 0x200 120 8 96 12 ""
;9 Edit 0x54030080 0x200 120 28 96 13 ""
;10 Edit 0x54030080 0x200 120 48 96 12 ""
;11 Edit 0x54030080 0x200 120 68 96 13 ""
;12 Edit 0x54030080 0x200 120 88 96 12 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "3 4 5 6 7 8 9 10 11 12"
str e3 e4 e5 e6 e7 e8 e9 e10 e11 e12

ARRAY(str) a
str pattern="[\x80-\xff]+" ;;Match all double byte characters
if(findrx(_s pattern 0 4 a)<0) out "does not match"; ret
for int'i 0 a.len
,sel i
,,case 0
,,e3 = a[0 i]
,,case 1
,,e4 = a[0 i]
,,case 2
,,e5 = a[0 i]
,,case 3
,,e6 = a[0 i]
,,case 4
,,e7 = a[0 i]
,,case 5
,,e8 = a[0 i]
,,case 6
,,e9 = a[0 i]
,,case 7
,,e10 = a[0 i]
,,case 8
,,e11 = a[0 i]
,,case 9
,,e12 = a[0 i]

if(!ShowDialog(dd 0 &controls)) ret

int ci
for i 0 a.len
,sel i
,,case 0
,,ci=_s.findreplace(a[0 i] F"{e3}")
,,case 1
,,ci=_s.findreplace(a[0 i] F"{e4}" 4 "" ci+e3.len)
,,case 2
,,ci=_s.findreplace(a[0 i] F"{e5}" 4 "" ci+e4.len)
,,case 3
,,ci=_s.findreplace(a[0 i] F"{e6}" 4 "" ci+e5.len)
,,case 4
,,ci=_s.findreplace(a[0 i] F"{e7}" 4 "" ci+e6.len)
,,case 5
,,ci=_s.findreplace(a[0 i] F"{e8}" 4 "" ci+e7.len)
,,case 6
,,ci=_s.findreplace(a[0 i] F"{e9}" 4 "" ci+e8.len)
,,case 7
,,ci=_s.findreplace(a[0 i] F"{e10}" 4 "" ci+e9.len)
,,case 8
,,ci=_s.findreplace(a[0 i] F"{e11}" 4 "" ci+e10.len)
,,case 9
,,ci=_s.findreplace(a[0 i] F"{e12}" 4 "" ci+e11.len)

paste _s


Messages In This Thread
RE: Unable to match all double byte characters - by macman - 01-05-2021, 06:28 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)