SunQuest
 
           .NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 10th, 2003, 05:45 AM
Djow Djow is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 1 Djow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
how many letters? help plz

the text "Hello dude" consists of 6 diffent letters... i got a text in written into a textbox , and i want to check how many diffrent letters there is.. how ? i saw someone use [a-z] thing, but i didnt quite get it... any sugestions ?

Reply With Quote
  #2  
Old October 17th, 2003, 02:43 AM
Gen-An Gen-An is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 1 Gen-An User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm not the best person to ask but no-oneelse seems to be answering your pleas.

I can offer two solutions neither of which are perfect.

The first is a solution that will only work if you know what characters are in the string, and that would be to just split the string by all of those characters:

string s = "whatever";
string[] spl = s.Split('w');
int amountOfThisCharacter = spl.length;

and so on with all your letters.

2nd is to write a time consuming switch:

foreach(char c in string s)
{
switch(c)
{
case 'a':
aCtr++;
break;

case 'b':
bCtr++;
break;
}
}
and so on......

Neither of these solutions are perfect, but they will work.

jax

Reply With Quote
  #3  
Old November 8th, 2003, 12:01 AM
Izzy Izzy is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 1 Izzy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Post



I am not sure what language you are using, but try this in VB.NET:

Sub BlahBlah()

Dim i, pintCountUniqueLetters as integer 'just to keep count
Dim YourString as String

'At some point after you have set a value for YourString

YourString = YourString.ToUpper

For i = 65 to 90
&nbsp;&nbsp;&nbsp;If YourString.IndexOf(Chr(i) <> -1 Then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YourString.Replace(Chr(i),"")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pintCountUniqueLetters +=1
&nbsp;&nbsp;&nbsp;End If
Next

End Sub



This should work

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > how many letters? help plz


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway