The Daily Click ::. Forums ::. Klik Coding Help ::. How can you find the ammount of a specific character in a paragraph?
 

Post Reply  Post Oekaki 
 

Posted By Message

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
5th July, 2005 at 09:26:54 -

I'm making a translator program that uses loops to search for a letter and replace it. The only problem is, I need to know how many of that specific letter there is so I know how many searches for that letter to replace. help?

 
thinking is like pong, it's easy, but you miss sometimes.

-Vinny-



Registered
  12/01/2005
Points
  436
5th July, 2005 at 10:20:53 -

why would you search for a letter? why not search for specific words? phizzy made a pretty good tutorial on making a translator program, just search for it in the articles

 
Vinny

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
5th July, 2005 at 10:51:17 -

>always
-set letter counter to 0
-set parser position counter to 0
-start loop "letter count" for (length of paragraph) # of loops

>on loop "letter count"
+>if midstr$("edit object",parser position counter, 1) = (the specific letter)
-add 1 to to letter counter

If you're using TGF, you'll need the fastloop and string parser2 objects. MMF has fastloops and midstring functions built in.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
5th July, 2005 at 11:43:11 -

Can the parse object check what you typed in (in RTF too)? Coz I need that for making a syntax highlighting system.
If not, how can I make it check my inserted text and add nicee colours in it?

 
Old member (~2004-2007).

Liquixcat

Administrator
Lazy Coder

Registered
  08/12/2002
Points
  201

VIP MemberLikes TDCKitty
5th July, 2005 at 11:51:40 -

I need to search for specific letters sensation. Yeah vince RTF definetly uses string searching. It's string replacing that is tough, not find a string.

Thanks Snerlin, worked great.

 
thinking is like pong, it's easy, but you miss sometimes.

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
6th July, 2005 at 08:08:03 -

DaVince: If you mean like a spellcheck, it can do that too, but you may have to make several different events for a bunch of words unless you can manage a thing that reads from a dictionary file.

 
n/a

Dave Matthew (Jester Gaming)



Registered
  09/07/2004
Points
  148
6th July, 2005 at 14:23:36 -

this would be like 200 times easier to do in java or something

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
6th July, 2005 at 20:12:35 -

Well it's not that hard in MMF either, if you are familiar with loops.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
7th July, 2005 at 05:24:17 -

Snerlin: not for spelling check but for color replacement. I'm trying to make a syntax highlighting system.

I'll just make a new thread about this.

 
Old member (~2004-2007).

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
7th July, 2005 at 11:08:44 -

nope, it can't do that

 
n/a
   

Post Reply



 



Advertisement

Worth A Click