Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to match all double byte characters
#6
since the number of elements in the array can vary. you cant just access an element that doesn't exist. It will cause an error. That was the main reason for using sel. you can do the same thing when the dialog closes 
Code:
Copy      Help
_s=
;DocumentModel document = new DocumentModel();
;
;Section section = new Section(document);
;document.Sections.Add(section);
;
;Paragraph paragraph = new Paragraph(document);
;section.Blocks.Add(paragraph);
;
;Run 文字一run = new Run(document, "文字二");
;paragraph.Inlines.Add(run);
;
;文字三document.Save("test.docx");文字四
;
;//文字
;ComponentInfo.SetLicense("FREE-LIMITED-KEY");

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 0x204 8 88 96 12 ""
;8 Edit 0x54030080 0x204 120 8 96 12 ""
;9 Edit 0x54030080 0x204 120 28 96 13 ""
;10 Edit 0x54030080 0x204 120 48 96 12 ""
;11 Edit 0x54030080 0x204 120 68 96 13 ""
;12 Edit 0x54030080 0x204 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]+"
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
i=0
for i 0 a.len
,sel i
,,case 0
,,_s.findreplace(a[0 i] F"{e3}")
,,case 1
,,_s.findreplace(a[0 i] F"{e4}")
,,case 2
,,_s.findreplace(a[0 i] F"{e5}")
,,case 3
,,_s.findreplace(a[0 i] F"{e6}")
,,case 4
,,_s.findreplace(a[0 i] F"{e7}")
,,case 5
,,_s.findreplace(a[0 i] F"{e8}")
,,case 6
,,_s.findreplace(a[0 i] F"{e9}")
,,case 7
,,_s.findreplace(a[0 i] F"{e10}")
,,case 8
,,_s.findreplace(a[0 i] F"{e11}")
,,case 9
,,_s.findreplace(a[0 i] F"{e12}")
out _s


Messages In This Thread
RE: Unable to match all double byte characters - by Kevin - 01-03-2021, 03:31 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)