.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:
  #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




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek