$PBExportHeader$w_main.srw $PBExportComments$Main window forward global type w_main from window end type type lb_msgs from listbox within w_main end type type cbx_case from checkbox within w_main end type type cb_stringclass_replace_all from commandbutton within w_main end type type cb_standard_replace_all from commandbutton within w_main end type type cb_cancel from commandbutton within w_main end type type cb_standard_concatenate from commandbutton within w_main end type type cb_stringclass_concatenate from commandbutton within w_main end type end forward global type w_main from window integer width = 1952 integer height = 1588 boolean titlebar = true string title = "StringClass" boolean controlmenu = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true lb_msgs lb_msgs cbx_case cbx_case cb_stringclass_replace_all cb_stringclass_replace_all cb_standard_replace_all cb_standard_replace_all cb_cancel cb_cancel cb_standard_concatenate cb_standard_concatenate cb_stringclass_concatenate cb_stringclass_concatenate end type global w_main w_main type prototypes Function ulong timeGetTime ( & ) Library "winmm.dll" end prototypes type variables String is_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." end variables forward prototypes public function string wf_elapsed (unsignedlong al_start) public function string wf_replaceall (string as_oldstring, string as_findstr, string as_replace, boolean ab_case) end prototypes public function string wf_elapsed (unsignedlong al_start);ULong lul_end, lul_elapsed lul_end = timeGetTime() lul_elapsed = lul_end - al_start Return String(lul_elapsed) + " milliseconds" end function public function string wf_replaceall (string as_oldstring, string as_findstr, string as_replace, boolean ab_case);String ls_newstring, ls_findstr Long ll_findstr, ll_replace, ll_pos If ab_case Then ls_newstring = as_oldstring ls_findstr = as_findstr Else ls_newstring = Lower(as_oldstring) ls_findstr = Lower(as_findstr) End If ll_findstr = Len(as_findstr) ll_replace = Len(as_replace) // find first occurrence ll_pos = Pos(ls_newstring, ls_findstr) Do While ll_pos > 0 // replace old with new ls_newstring = Replace(ls_newstring, ll_pos, ll_findstr, as_replace) // find next occurrence ll_pos = Pos(ls_newstring, ls_findstr, (ll_pos + ll_replace)) Loop Return ls_newstring end function on w_main.create this.lb_msgs=create lb_msgs this.cbx_case=create cbx_case this.cb_stringclass_replace_all=create cb_stringclass_replace_all this.cb_standard_replace_all=create cb_standard_replace_all this.cb_cancel=create cb_cancel this.cb_standard_concatenate=create cb_standard_concatenate this.cb_stringclass_concatenate=create cb_stringclass_concatenate this.Control[]={this.lb_msgs,& this.cbx_case,& this.cb_stringclass_replace_all,& this.cb_standard_replace_all,& this.cb_cancel,& this.cb_standard_concatenate,& this.cb_stringclass_concatenate} end on on w_main.destroy destroy(this.lb_msgs) destroy(this.cbx_case) destroy(this.cb_stringclass_replace_all) destroy(this.cb_standard_replace_all) destroy(this.cb_cancel) destroy(this.cb_standard_concatenate) destroy(this.cb_stringclass_concatenate) end on type lb_msgs from listbox within w_main integer x = 73 integer y = 756 integer width = 1797 integer height = 528 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 boolean vscrollbar = true boolean sorted = false borderstyle borderstyle = stylelowered! end type type cbx_case from checkbox within w_main integer x = 1029 integer y = 640 integer width = 837 integer height = 68 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Case Sensitive Replace All" end type type cb_stringclass_replace_all from commandbutton within w_main integer x = 1024 integer y = 384 integer width = 846 integer height = 228 integer taborder = 50 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "StringClass Replace All" end type event clicked;n_stringclass sc String ls_data, ls_replaced ULong lul_start Integer li_idx SetPointer(HourGlass!) sc.alloc(225000) sc.copy("-start-") For li_idx = 1 To 500 sc.concat("-" + String(li_idx) + "-") sc.concat(is_string) Next ls_data = sc.value() lul_start = timeGetTime() ls_replaced = sc.ReplaceAll(ls_data, "in", "trouble", cbx_case.Checked) lb_msgs.AddItem(this.text + ": " + wf_elapsed(lul_start)) SetPointer(Arrow!) end event type cb_standard_replace_all from commandbutton within w_main integer x = 1024 integer y = 64 integer width = 846 integer height = 228 integer taborder = 40 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Standard Replace All" end type event clicked;n_stringclass sc String ls_data, ls_replaced ULong lul_start Integer li_idx SetPointer(HourGlass!) sc.alloc(225000) sc.copy("-start-") For li_idx = 1 To 500 sc.concat("-" + String(li_idx) + "-") sc.concat(is_string) Next ls_data = sc.value() lul_start = timeGetTime() ls_replaced = wf_ReplaceAll(ls_data, "in", "trouble", cbx_case.Checked) lb_msgs.AddItem(this.text + ": " + wf_elapsed(lul_start)) SetPointer(Arrow!) end event type cb_cancel from commandbutton within w_main integer x = 1463 integer y = 1344 integer width = 407 integer height = 100 integer taborder = 30 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Cancel" boolean cancel = true end type event clicked;Close(Parent) end event type cb_standard_concatenate from commandbutton within w_main integer x = 73 integer y = 64 integer width = 846 integer height = 228 integer taborder = 20 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Standard Concatenate" end type event clicked;String ls_data ULong lul_start Integer li_idx SetPointer(HourGlass!) lul_start = timeGetTime() ls_data = "-start-" For li_idx = 1 To 500 ls_data = ls_data + "-" + String(li_idx) + "-" ls_data = ls_data + is_string Next lb_msgs.AddItem(this.text + ": " + wf_elapsed(lul_start)) SetPointer(Arrow!) end event type cb_stringclass_concatenate from commandbutton within w_main integer x = 73 integer y = 384 integer width = 846 integer height = 228 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "StringClass Concatenate" end type event clicked;n_stringclass sc String ls_data ULong lul_start Integer li_idx SetPointer(HourGlass!) lul_start = timeGetTime() sc.alloc(225000) sc.copy("-start-") For li_idx = 1 To 500 sc.concat("-" + String(li_idx) + "-") sc.concat(is_string) Next ls_data = sc.value() lb_msgs.AddItem(this.text + ": " + wf_elapsed(lul_start)) SetPointer(Arrow!) end event
- Sources
- TopWiz
- stringclass
- PB
- w_main.srw
File: w_main.srw
Size: 8248
Date: Mon, 31 Dec 2018 21:14:39 +0100
Size: 8248
Date: Mon, 31 Dec 2018 21:14:39 +0100
- window w_main(srw)
- wf_elapsed (unsignedlong al_start) returns string
- wf_replaceall (string as_oldstring, string as_findstr, string as_replace, boolean ab_case) returns string
- listbox lb_msgs
- checkbox cbx_case
- commandbutton cb_stringclass_replace_all
- commandbutton cb_standard_replace_all
- commandbutton cb_cancel
- commandbutton cb_standard_concatenate
- commandbutton cb_stringclass_concatenate