Re: Use strings in Mathematica, like in C?
- To: mathgroup at smc.vnet.net
- Subject: [mg61366] Re: [mg61354] Use strings in Mathematica, like in C?
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Mon, 17 Oct 2005 02:29:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi (again)
> 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?
Just re-read the question ... Try
old = "hello";
new = StringReplacePart[old, "?StringReplacePart", {1, 5}] //
ToExpression
Same advice for searching applies.
Regards,
Dave.