Raised This Month: $ Target: $400
 0% 

remove letters frome string?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 01-02-2008 , 15:33   remove letters frome string?
Reply With Quote #1

have always wonder how but have never known?
Code:
 
if(contain(map, "de_"))
{
//remove _de
}
fxfighter is offline
Send a message via MSN to fxfighter
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-02-2008 , 16:31   Re: remove letters frome string?
Reply With Quote #2

It depends how you code after that.

There are severals ways using, strtok(), contain(), etc..

with strtok:
Code:
 strtok( sMap, sPrefix, charsmax( sPrefix ), sMap, charsmax( sMap ), '_' );
__________________
Arkshine is offline
Old 01-02-2008, 16:57
fxfighter
This message has been deleted by fxfighter. Reason: gfaw
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-02-2008 , 17:03   Re: remove letters frome string?
Reply With Quote #3

In case where you don't need to remove prefix map, you can do something like:

Code:
sMap[ contain( sMap, "_" ) + 1 ];

E.g.: you want to display map without prefix, you can do directly :

Code:
client_print( id, print_chat, "Current Map : %s", sMap[ contain( sMap, "_" ) + 1 ] );

contain() returns position of '_'. And +1, because we want to display all characters after '_'.

That's why I've said it depends how you code after.
__________________

Last edited by Arkshine; 01-02-2008 at 17:07.
Arkshine is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-02-2008 , 17:56   Re: remove letters frome string?
Reply With Quote #4

Code:
replace(string, len, "de_", "")

if( equal(string, "de_", 3) )
  copy( string, len, string[3])
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Reply



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


All times are GMT -4. The time now is 11:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode