Raised This Month: $ Target: $400
 0% 

Removing from String


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-26-2017 , 09:26   Removing from String
Reply With Quote #1

How could i remove from this string
Code:
models/v_weapon.mdl
the following
Code:
models/v_
Code:
.mdl
So it would remain
Code:
weapon
__________________

Last edited by Depresie; 07-26-2017 at 09:26.
Depresie is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-26-2017 , 09:29   Re: Removing from String
Reply With Quote #2

Easiest way is with replace.
__________________
HamletEagle is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 07-26-2017 , 10:12   Re: Removing from String
Reply With Quote #3

Thanks, solved

PHP Code:
new szString[32] = "models/v_weapon.mdl"
replace(szStringcharsmax(szString), ".mdl""")
replace(szStringcharsmax(szString), "models/v_"""
__________________
Depresie is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-29-2017 , 12:46   Re: Removing from String
Reply With Quote #4

If the start position is known/constant, you can also do this:
PHP Code:
new szTest[] = "models/v_weapon.mdl";
    
szTestsizeofszTest ) - ] = EOS;
    
server_print"[%s]" szTest] ); 
Output:
Code:
[weapon]
__________________

Last edited by Bugsy; 07-29-2017 at 12:47.
Bugsy is offline
Reply


Thread Tools
Display Modes

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 23:10.


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