![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Mar 2007
Posts: 33
Rep Power: 0
![]() |
Split String into individual characters
Hi,
I am trying to split a string into individual letters in VBScript. str=text i want to get back an array where: a(0) = t a(1) = e a(2) = s a(3) = t there is: a=split(str,"") but it actually requires a character.. i have used other scripting languages where specifying "" means it will automatically split between every letter.. not helpful in this case. The eventual script is to count how many UpperCase characters there are in a given string. Cheers tAK So, i have this: BUT, i have to enter input as: t/E/s/t instead of: tEst i want the latter.. any ideas please ? <html>
<head>
<HTA:APPLICATION
APPLICATIONNAME="Count UpperCase"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="Normal"
>
</head>
<body>
<script type="text/vbscript">
txtInput=InputBox("Enter a string:")
txtUpper=UCase(txtInput)
document.write("Your Input was: " & txtInput & "<br />")
arNormal=Split(txtInput,"/",-1,1)
arUpper=Split(txtUpper,"/",-1,1)
For i=0 to UBound(arNormal)
If StrComp(arUpper(i),arNormal(i)) = 0 Then intUpperChars = intUpperChars + 1
If StrComp(arUpper(i),arNormal(i)) = -1 Then intLowerChars = intLowerChars + 1
Next
document.write("Total Uppercase Characters = " & intUpperChars & "<br />")
document.write("Total Lowercase Characters = " & intLowerChars & "<br />")
</script>
</body>
</html>Last edited by tAK; Jun 20th, 2007 at 11:16 PM. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| An Attempt at a DBMS | grimpirate | PHP | 8 | Apr 17th, 2007 1:01 PM |
| Function Parameters | grimpirate | PHP | 10 | Mar 14th, 2007 6:55 PM |
| C# corruption!!! | Kilo | C++ | 32 | May 21st, 2006 8:44 PM |
| Array issues :( | Alo Tsum | Java | 10 | Nov 26th, 2005 5:45 PM |
| replace space with ' * ' | TecBrain | C++ | 15 | Apr 13th, 2005 12:32 PM |