Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'http://www.sqaforums.com/forums/hp-unified-functional-testing-uft-mercury-quicktest-pro-qtp/153612-how-get-number-separately-string-vbscript.html
- '
- Function SplitNumAndText(strInput)
- Dim strNumbers, strLetters
- strNumbers = "" : strLetters = ""
- For intChar = 1 To Len(strInput)
- If IsNumeric(Mid(strInput, intChar, 1)) Then
- strNumbers = strNumbers & Mid(strInput, intChar, 1)
- Else
- strLetters = strLetters & Mid(strInput, intChar, 1)
- End If
- Next
- 'SplitNumAndText = strNumbers & " and " & strLetters
- SplitNumAndText = strNumbers
- End Function
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- objStartFolder = "E:\test\testmap"
- Set objFolder = objFSO.GetFolder(objStartFolder)
- Set colFiles = objFolder.Files
- max = "0"
- For Each objFile in colFiles
- 'Wscript.Echo objFile.Name
- 'msgbox SplitNumAndText(objFile.Name)
- fileNumber = SplitNumAndText(objFile.Name)
- If fileNumber > max Then
- 'do whatever'
- max = fileNumber
- End If
- Next
- 'Max number
- msgbox max
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement