Raised This Month: $95 Target: $400
 23% 

SplitString the other part


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ofir753
Senior Member
Join Date: Aug 2012
Old 02-02-2014 , 12:24   SplitString the other part
Reply With Quote #1

I am using splitstring but i want to other part
Code:
new String:part[64]
ReplaceString("Hello World !!!", 64, "World", part, true);
PrintToChatAll(part);
The output will be: "Hello "
I want the output will be:" !!!"
ofir753 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 02-02-2014 , 12:44   Re: SplitString the other part
Reply With Quote #2

Hi, your posted code doesn't make sense, please explain more detailled what exactly you want to achieve, thanks.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
ofir753
Senior Member
Join Date: Aug 2012
Old 02-02-2014 , 12:47   Re: SplitString the other part
Reply With Quote #3

Quote:
Originally Posted by berni View Post
Hi, your posted code doesn't make sense, please explain more detailled what exactly you want to achieve, thanks.
When you are split string its take the part from the left and i want the part from the right
ofir753 is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 02-02-2014 , 13:13   Re: SplitString the other part
Reply With Quote #4

Something like this?

PHP Code:
stock bool:SplitStringRight( const String:source[], const String:split[], String:part[], partLen )
{
    new 
index StrContainssourcesplit ); // get start index of split string
    
    
if( index == -// split string not found..
        
return false;
    
    
index += strlensplit ); // get end index of split string    
    
strcopypartpartLensourceindex ] ); // copy everything after source[ index ] to part
    
return true;

Not tested.. first try
KissLick is offline
ofir753
Senior Member
Join Date: Aug 2012
Old 02-02-2014 , 13:44   Re: SplitString the other part
Reply With Quote #5

Quote:
Originally Posted by KissLick View Post
Something like this?

PHP Code:
stock bool:SplitStringRight( const String:source[], const String:split[], String:part[], partLen )
{
    new 
index StrContainssourcesplit ); // get start index of split string
    
    
if( index == -// split string not found..
        
return false;
    
    
index += strlensplit ); // get end index of split string    
    
strcopypartpartLensourceindex ] ); // copy everything after source[ index ] to part
    
return true;

Not tested.. first try
Thanks its works!!!
ofir753 is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 02-02-2014 , 14:22   Re: SplitString the other part
Reply With Quote #6

A little mistake in my code..

PHP Code:
stock bool:SplitStringRight( const String:source[], const String:split[], String:part[], partLen 

    new 
index StrContainssourcesplit ); // get start index of split string 
     
    
if( index == -// split string not found.. 
        
return false
     
    
index += strlensplit ); // get end index of split string

    
if( index == strlensource ) - // no right side exist
        
return false;
 
    
strcopypartpartLensourceindex ] ); // copy everything after source[ index ] to part 
    
return true

KissLick 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:11.


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