Liberty Unleashed

Scripting => Script Help => Topic started by: ZX_Lost_Soul on November 07, 2013, 07:42:58 am

Title: Replace one letter with another in the string
Post by: ZX_Lost_Soul on November 07, 2013, 07:42:58 am
Code: [Select]
txt="Sometext";How to replace a letter in the string? I try:
Code: [Select]
txt[1]=3;
txt[1]='c';
txt[1]="c";
local letter="c";
txt[1]=letter.tochar();
...but nothing works(

Maybe Squirel have analog of str_replace() (http://"http://php.net/manual/ru/function.str-replace.php") ?
Title: Re: Replace one letter with another in the string
Post by: Benedani on August 20, 2015, 06:01:40 pm
Strings are not arrays. This example wouldn't work. You'll have to create the modified string yourself.
Title: Re: Replace one letter with another in the string
Post by: PerikiyoXD on August 20, 2015, 11:43:21 pm
isnt a string a char array?