AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change a letter in a string (https://forums.alliedmods.net/showthread.php?t=93208)

elpouletorange 05-25-2009 17:36

Change a letter in a string
 
Hello, this isn't okay but I don't know how to do it.

Code:


1  new nextmap[32]
2  get_cvar_string("amx_nextmap", nextmap, 31)
3  if (nextmap[0] == "a")
4    {
5    nextmap[0] = "A"
6    }

I want to change the first letter of the string nextmap to the same but in MAJ. My example is what it do if the first letter is "a".

Error: Array must be indexed (variable "-unknown-") on line 3
Error: Must be assigned to an array on line 5

Thanks you :)

Arkshine 05-25-2009 17:47

Re: Change a letter in a string
 
use ' not "

elpouletorange 05-25-2009 18:04

Re: Change a letter in a string
 
Thank you :D

ConnorMcLeod 05-25-2009 18:06

Re: Change a letter in a string
 
You could also use ucfirst native or toupper

ucfirst(nextmap)

or

nextmap[0] = toupper(nextmap[0])


All times are GMT -4. The time now is 01:32.

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