Raised This Month: $51 Target: $400
 12% 

Replace first character in a string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-13-2018 , 19:38   Replace first character in a string
Reply With Quote #1

I need function who will replace first character in a string with new value for that character.
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
maqi
Senior Member
Join Date: Apr 2017
Location: Serbia
Old 07-13-2018 , 20:06   Re: Replace first character in a string
Reply With Quote #2

Elaborate.
__________________
stuff
maqi is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-13-2018 , 22:45   Re: Replace first character in a string
Reply With Quote #3

Code:
szString[0] = 'a'
__________________
fysiks is online now
Old 07-14-2018, 06:00
Ghosted
This message has been deleted by Arkshine. Reason: Please don't sarcasm, it's unnecessary and people might not understand.
Old 07-14-2018, 07:00
CrAzY MaN
This message has been deleted by Arkshine. Reason: Answer to deleted message
BaD CopY
Senior Member
Join Date: Oct 2014
Location: Home
Old 07-20-2018 , 11:35   Re: Replace first character in a string
Reply With Quote #6

I want hardcoded values for each character and function to replace first character with hardcoded value for that character

replaceWith[][] = {"a", "A"}

string = abc

function should return 'Abc'
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: Macedonia
Old 07-21-2018 , 06:02   Re: Replace first character in a string
Reply With Quote #7

Quote:
Originally Posted by BaD CopY View Post
replaceWith[][] = {"a", "A"}

string = abc

function should return 'Abc'
So why 'Abc' instead of 'abc' when replaceWith has both 'a' and 'A' values?

Last edited by edon1337; 07-21-2018 at 06:02.
edon1337 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-21-2018 , 13:48   Re: Replace first character in a string
Reply With Quote #8

Quote:
Originally Posted by edon1337 View Post
So why 'Abc' instead of 'abc' when replaceWith has both 'a' and 'A' values?
Presumably that is the before and after characters.
__________________
fysiks is online now
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 #9

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 ?
BaD CopY is offline
Send a message via Yahoo to BaD CopY Send a message via Skype™ to BaD CopY
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 07-20-2018 , 11:49   Re: Replace first character in a string
Reply With Quote #10

https://www.amxmodx.org/api/string/ucfirst
__________________
Relaxing is offline
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 19:40.


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