Increment a numerical string: Difference between revisions

Content deleted Content added
Added J solution.
Line 163:
print, string(fix(str)+1)
;==> 1235
 
=={{header|J}}==
incrTextNum=: ": @ >: @ (_&".)
Examples follow. Note that in addition to working for a single numeric value, this will increment multiple values provided within the same string, on a variety of number types and formats.
incrTextNum '34.5'
35.5
incrTextNum '7 0.2 3r5 2j4 5.7e-4'
8
1.2
1.6
3j4
1.00057
 
=={{header|Java}}==