Raised This Month: $275 Target: $400
 68% 

Replace first character in a string


Post New Thread Reply   
 
Thread Tools Display Modes
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-21-2018 , 15:13   Re: Replace first character in a string
Reply With Quote #11

Quote:
Originally Posted by fysiks View Post
Presumably that is the before and after characters.
Yeah, in that example 'a' is first character of string and 'A' is a value who will be replaced with 'a'..

How to detect values to replace with first character ?
__________________
Help me in other requests: Top15 Motd | Unlimited ammo for paintball guns
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-21-2018 , 15:37   Re: Replace first character in a string
Reply With Quote #12

Quote:
Originally Posted by fysiks View Post
Is this new string going to be a single character or more than one character? If it's always only 1 character, do what I said.
Also how to replace first 2 characters with some new values ?

Values { 'ho', '+' }

so string "home" will be "+me"
__________________
Help me in other requests: Top15 Motd | Unlimited ammo for paintball guns
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Traphouse
Old 07-21-2018 , 15:48   Re: Replace first character in a string
Reply With Quote #13

Quote:
Originally Posted by BaD CopY View Post
Also how to replace first 2 characters with some new values ?

Values { 'ho', '+' }

so string "home" will be "+me"
PHP Code:
new const szGivenString "home";

new const 
szReplaceString[ ][ ] =
{
    { 
"ho""+" }
}

replaceszGivenStringcharsmaxszGivenString ), szReplaceString][ ], szReplaceString][ ] ); 
__________________
~ Turn incapability into motivation. ~

Last edited by edon1337; 07-21-2018 at 15:49.
edon1337 is offline
Send a message via Skype™ to edon1337
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-21-2018 , 19:43   Re: Replace first character in a string
Reply With Quote #14

Quote:
Originally Posted by BaD CopY View Post
Also how to replace first 2 characters with some new values ?

Values { 'ho', '+' }

so string "home" will be "+me"
It sounds like you need to explain better what you are actually trying to do. You need to provide a bigger picture of your goal because your request doesn't make a whole lot of sense (without context) and you keep changing the request.
__________________
fysiks is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 07-21-2018 , 20:25   Re: Replace first character in a string
Reply With Quote #15

http://xyproblem.info
__________________
ddhoward is offline
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old Yesterday , 17:05   Re: Replace first character in a string
Reply With Quote #16

Quote:
Originally Posted by fysiks View Post
It sounds like you need to explain better what you are actually trying to do. You need to provide a bigger picture of your goal because your request doesn't make a whole lot of sense (without context) and you keep changing the request.
ok, my real idea is to make decoder and encoder for given strings..

PHP Code:
new name[32];

get_user_name(idnamecharsmax(name);

decode(name); 
I need decode function to replace each character of name with values for that character.. After that I need encode function to replace every two characters back to normal name.
__________________
Help me in other requests: Top15 Motd | Unlimited ammo for paintball guns
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
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 01:46.


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