Posts tagged strings

Convert number to binary in Javascript

Why did it take me so long to find this? Probably because I didn’t use radix in my Google search. Of course. Thanks to “Philip M” for the clue and thanks to for the reference (see here for more on the unary “+” operator to convert a string to number). var str = ’37′; [...]

Line breaks in textarea from Access

To retain linebreaks in textarea from an MS Access database,  replace linefeeds with carriage return/linefeed pair and then save the input. Javascript example: strInput.replace(/\n/g, ‘%0D%0A’) This replaces all linefeeds (line breaks) in the strInput (using “/\n/g”) with %0D%A which signal end of data (same as a carriage return and linefeed). The original input from the [...]