AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Need help with strings (https://forums.alliedmods.net/showthread.php?t=313391)

thEsp 01-07-2019 14:09

Need help with strings
 
Greetings,
I have an problem reading strings. I want to execute a command if an strings starts with x specific letter.

For example:
PHP Code:

if(string_startswith(stringOne,";")) {



Im using this:
PHP Code:

if(containi(stringOne,";")) {



But this checks if string has a custom x letter/string rather than checking if it starts with it.
Thanks in advance :)

Solution: if(equal(string,";",1))

Relaxing 01-07-2019 14:21

Re: Need help with strings
 
Code:
hi[6] = "hello" hi[0] = "h" hi[1] = "e" hi[2] = "l" hi[3] = "l" hi[4] = "o"
You get what I mean?

OciXCrom 01-07-2019 14:39

Re: Need help with strings
 
PHP Code:

if(string[0] == ';'


CrazY. 01-07-2019 14:39

Re: Need help with strings
 
Code:
if (buffer[0] == 'x') // something


All times are GMT -4. The time now is 07:35.

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