$PBExportHeader$w_main.srw $PBExportComments$Main window forward global type w_main from window end type type cb_reset from commandbutton within w_main 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 = 1696 integer height = 1620 boolean titlebar = true string title = "StringClass" boolean controlmenu = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_reset cb_reset 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.cb_reset=create cb_reset 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.cb_reset,& 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.cb_reset) 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 cb_reset from commandbutton within w_main integer x = 73 integer y = 1376 integer width = 407 integer height = 100 integer taborder = 60 integer textsize = -8 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Reset" end type event clicked;lb_msgs.Reset() end event type lb_msgs from listbox within w_main integer x = 73 integer y = 672 integer width = 1541 integer height = 644 integer taborder = 50 integer textsize = -8 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 = 882 integer y = 544 integer width = 699 integer height = 68 integer textsize = -8 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 = 878 integer y = 320 integer width = 736 integer height = 196 integer taborder = 40 integer textsize = -8 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.Reserve(225000) sc.Copy("-start-") For li_idx = 1 To 500 sc.Append("-" + String(li_idx) + "-") sc.Append(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 = 878 integer y = 64 integer width = 736 integer height = 196 integer taborder = 30 integer textsize = -8 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.Reserve(225000) sc.Copy("-start-") For li_idx = 1 To 500 sc.Append("-" + String(li_idx) + "-") sc.Append(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 = 1207 integer y = 1376 integer width = 407 integer height = 100 integer taborder = 70 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 = 736 integer height = 196 integer taborder = 10 integer textsize = -8 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 = 320 integer width = 736 integer height = 196 integer taborder = 20 integer textsize = -8 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.Reserve(225000) sc.Copy("-start-") For li_idx = 1 To 500 sc.Append("-" + String(li_idx) + "-") sc.Append(is_string) Next ls_data = sc.Value() lb_msgs.AddItem(this.text + ": " + wf_elapsed(lul_start)) SetPointer(Arrow!) end event
- Sources
- TopWiz
- stringclass
- PB105
- w_main.srw
File: w_main.srw
Size: 8794
Date: Thu, 03 Oct 2019 05:12:34 +0200
Size: 8794
Date: Thu, 03 Oct 2019 05:12:34 +0200
- 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
- commandbutton cb_reset
- 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