Take the string within the specified range

xiaoxiao2021-03-06  47

'********************************************** ** Function Name: getgivenstr '** function function: Take the string' ** parameter description in the specified range: '** strsource is the source string, that is, the string "** strsTartKey before the decomposition is the start string' ** StrendKey means end string '** lngdefstart refers to the default start position' ** function returns: '** String Type' ** "" Can't find the specified string '** a string first found Eligible string '** Reference example:' ** such as strTemp = "My friend [001] Other characters" "** Now take the 001 now, then you can use '** strreturn = getgivenstr (strTemp, "[", "]") '**************************************** ******* PUBLIC FUNCTION GETGIVENSTR (byval strsource as string, _ byval strstartkey as string, _ byval strendkey as string, _ optional byval lngdefstart as stay = 1) AS STRING

DIM LNGSTART AS Long Dim LNGEND AS long '// Discoves the position of the start string and end strings LNGStart = INSTARTR (STRSTARTKEY)' // If this character is not found, then exit this function if LNGStart = 0 Then getgivenstr = "" EXIT function end if '// Plus the starting position plus the length of the string starting, such as strStartKey = "(", then add 1 LNGStart = LNGSTART LEN (STRSTARTKEY)' // Find the end String LNGEND = INSTR (LNGSTART, STRSOUR, STRENDKEY) '// If there is no found, exit function if lngstart = 0 or lngend = 0 Then getGivenstr = "" "EXIT function end if' // acquisition designation Range character getgivenstr = mid $ (strsource, lngstart, lngend - lngstart) end function

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

New Post(0)