The Daily Click ::. Forums ::. Klik Coding Help ::. Removing characters from a string?
 

Post Reply  Post Oekaki 
 

Posted By Message

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
11th April, 2007 at 19:46:07 -

I want to remove a certain character from a generated string. Is there any super awesome way of doing this?

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

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
11th April, 2007 at 20:14:19 -

For MMF2, your best option is the substring replace option.
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=30537&page=1#Post30537
But I must warn you, it's pretty super awesome.

If you're using MMF 1.5 then you can use the string manipulator object to do the same thing.

Edit:
I should probably mention to do it youl would use the object and:
Replace [your character] with ""
I.e Replace "J" with "" would turn "Jack is John" to "ack is ohn".
Enjoy.

Image Edited by an Administrator.

 
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

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
12th April, 2007 at 07:36:48 -

That is pretty damn mega. Thank you Andy.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
12th April, 2007 at 10:54:26 -

If you are always removing the same character in the string (like say, always the 3rd character from the left), you can always assign a new string the value you want by using the Left$ and Mid$ functions.

It works like this: Mid$("string",a,b)

Where "a" is how many places from the left your character is, and "b" is how many from the right to return the value from.

string = "AWESOME"

Mid$("string",3,2) would be "ES"
Mid$("string",5,1) would be "O", and so on.

It's a really useful feature.

So say you want to remove the 4th character, try something like this:

newstring = left$("string",3) + mid$("string",5,(len("string") - 1))

newstring = "AWEOME"

EDIT: Hmmmm, this sure looks like a bunch of convoluted crap, but maybe that'll help somehow. Or maybe not.. RETREAT!!

Image Edited by the Author.

Image Edited by the Author.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!
   

Post Reply



 



Advertisement

Worth A Click