Frog Recommendation: Write a string utility function with VBS

zhaozj2021-02-12  141

<% class wawa_str 'Create a class named WAWA' ********* ********************************************* The purpose : String utility, each method has made a corresponding comment, I don't use the regular expression to determine the boundary of the search string, just simply write the function, if you want to judge the boundary, you should use / b, ' the main vbs political expression is difficult to use, so I can not write, then the next time the class about perfect 'and rewrite it into a C # version of the' author: NEW YORK frog Prince 'variable: WawaValue (private Variable) 'Attribute:' Method: '************************************************** **************** Private Wawavalue 'Create an internal private variable private sub coplass_initialize () defines the initialization event End Sub Private Sub class_terminate' set the Terminate event.

'Empty Event class definition End Sub Public Property Let propertywawa (ByVal wawa_arg)' class definition a let property WawaValue = wawa_arg End Property Public Property Get propertywawa () 'defines a class get attribute propertywawa = WawaValue End Property Public Function GetFront ( ByVal mainStr, ByVal searchStr) 'acquired character string to search for the left dim FoundOffset FoundOffset = instr (mainStr, searchStr) If FoundOffset = 1 Then getfront = "" End If getfront = mid (mainStr, 1, foundoffset-1) End Function public Function getend (ByVal mainStr, ByVal searchStr) 'acquires the right to search a character string dim FoundOffset FoundOffset = instr (mainStr, searchStr) If FoundOffset = 1 Then getend = null End If getend = mid (mainstr, len (searchstr) 1) End Function Public Function insertString (ByVal mainStr, ByVal searchStr, ByVal insertStr) 'dim front insert a string before the character string to be searched, endwawa front = getfront (mainstr, searchstr) endwawa = getend (mainstr, searchstr) insertstring = (Front & Insertstr & Endwawa) End FunctionPublic Function DELETESTRING (Byval Mainstr, BYVAL DELETEST "Delete the string to search deleteString = Replace (Mainstr, deleteStr," ") End Function

转载请注明原文地址:https://www.9cbs.com/read-6764.html

New Post(0)