Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #24925
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Can you change value of a substring? |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <a6d074ff-773b-42d0-96dc-31bd5d733e3d@googlegroups.com> <XnsA350E19EA17B4eejj99@194.109.133.133> <cfc0ab9a-3ab2-4029-89ef-24282d7fc696@googlegroups.com> <XnsA350EDC4CEDE5eejj99@194.109.133.133> <3c78f76c-fc9f-4475-bbe0-b5e25893fcda@googlegroups.com> |
| Date | 2014-06-19 00:31 +0200 |
| Message-ID | <XnsA3515515EA31eejj99@194.109.133.133> (permalink) |
jonas.thornvall@gmail.com wrote on 18 jun 2014 in comp.lang.javascript:
> Honestly Jan
Jonas, my name is not Jan.
> i do not give a shit of
I am not interested in your bowel movements.
> the meticolusly inner works of the functions substr() and substring().
Well you should, Javascript has strings as variable values, but NOT
substrings.
Your false premisse lead to your misunderstanding.
> But from a meta parspective and a
Please [for your sake] do not have perspectives meta or not,
that have no logic in the functionning of Javascript.
> bit naive maybe i was thinking that it could be possible to feed the
> function calls
What function calls?
> with parameters to change the substring,
Javascript has no substrings, just the methods substr() and substring(),
which both just return a string.
If you mean these methods, even if that was possible, it would only affect
the resulting returned string.
You might look into the marvelously implemented Regular Expression methods,
like replace(). replace() makes it possible to have a fully manipulated
string returned wich you can assign to the old string's variable.
TRY THIS:
<script type='text/javascript'>
var myString = '12345';
myString = myString.replace(/\d$/,incr);
alert(myString); // 12346
myString = myString.replace(/\d$/,incr);
alert(myString); // 12347
function incr(a){return 1+ +a};
</script>
Being naive is fine, but protesting against the incidental revealing is not.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 12:39 -0700
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 13:09 -0700
Re: Can you change value of a substring? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-18 23:18 +0200
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-19 00:35 +0200
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 15:52 -0700
Re: Can you change value of a substring? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-06-18 16:14 -0700
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-18 22:10 +0200
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 13:17 -0700
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-18 22:52 +0200
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 14:03 -0700
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-19 00:07 +0200
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 15:28 -0700
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 13:20 -0700
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-18 23:22 +0200
Re: Can you change value of a substring? jonas.thornvall@gmail.com - 2014-06-18 14:40 -0700
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-19 00:31 +0200
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-18 23:42 +0200
Re: Can you change value of a substring? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-19 00:13 +0200
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-19 00:45 +0200
Re: Can you change value of a substring? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-19 01:32 +0200
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-19 09:43 +0200
Re: Can you change value of a substring? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-19 01:48 +0200
Re: Can you change value of a substring? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-06-19 09:56 +0200
Re: Can you change value of a substring? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-06-18 16:12 -0700
csiph-web