Author Topic: Replace one letter with another in the string  (Read 1297 times)

ZX_Lost_Soul

  • Newbie
  • *
  • Posts: 25
  • Karma: +1/-1
    • View Profile
Replace one letter with another in the string
« 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() ?
« Last Edit: November 07, 2013, 08:05:38 am by ZX_Lost_Soul »
My English is very poor, please try to understand me)

Benedani

  • Newbie
  • *
  • Posts: 17
  • Karma: +2/-0
    • View Profile
Re: Replace one letter with another in the string
« Reply #1 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.

PerikiyoXD

  • Newbie
  • *
  • Posts: 16
  • Karma: +3/-2
  • DUUH DO IT NOW!
    • View Profile
Re: Replace one letter with another in the string
« Reply #2 on: August 20, 2015, 11:43:21 pm »
isnt a string a char array?

 

© Liberty Unleashed Team.