Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jun 20th, 2007, 10:33 PM   #1
tAK
Programmer
 
Join Date: Mar 2007
Posts: 33
Rep Power: 0 tAK is on a distinguished road
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.
tAK is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:51 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC