MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Use strings in Mathematica, like in C?


On 10/16/05 at 12:18 AM, renan.birck at gmail.com (Renan) wrote:

>In the C programming language I can operate directly over the
>characters of a string, like:

>int main() {

>char message[16] = "Hello!"; message[n]='a';

>/* ... other code ... */
>return(0);

>}

>This mean: Change the (n+1)th character (in C, array starts at 0)
>to the specified character.

>Q: How can I obtain similar effect in Mathematica?

For strings, use StringReplacePart. For example

In[1]:=
StringReplacePart["Hello", "a", {3, 3}]
Out[1]=
"Healo"
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Mathematica not simplifying Laplace transforms
  • Next by Date: Re: Use strings in Mathematica, like in C?
  • Previous by thread: Re: Use strings in Mathematica, like in C?
  • Next by thread: Re: Use strings in Mathematica, like in C?