Login  Register

Re: What am I missing with fromCharCode?

Posted by Herbie on Oct 16, 2017; 10:24am
URL: http://imagej.273.s1.nabble.com/What-am-I-missing-with-fromCharCode-tp5019538p5019548.html

Dear Michael, dear Philippe!

"Maybe try with str = fromCharCode(181); "

str = "µ";
//str = fromCharCode(181);
xstr = "x [" + str + "m]";
setResult( xstr, 0, 123 );
updateResults();
//
//str = "µ";
str = fromCharCode(181);
xstr = "x [" + str + "m]";
xval = getResult( xstr , 0 );
print( xval );
str = String.getResultsHeadings;
print( str );

This works here!

Best

Herbie

:::::::::::::::::::::::::::::::::::::::::::
Am 16.10.17 um 12:19 schrieb Michael Schmid:

> Hi Philippe,
>
> there are several unicode characters that look like the greek mu,
> Unicode u+00b5 = 181, u+03bc = 956. The first is part of the 'Western'
> extensions to ascii, the latter is part of the Greek character set.
>
> Maybe try with str = fromCharCode(181);
>
> Michael
> ________________________________________________________________
> On 16/10/2017 09:32, Philippe CARL wrote:
>> Dear all,
>>
>> The following macro code used on some of my data is working correctly:
>>
>>                  str     = "µ";
>>
>>                  xstr   = "x [" + str + "m]";
>>
>>                  ystr   = "y [" + str + "m]";
>>
>>
>>                  for (i = 0; i != nResults; i++)
>>
>>                  {
>>
>>                                  xval  [i] = getResult(xstr , i);
>>
>>                                 yval  [i] = getResult(ystr , i);
>>
>>                  }
>>
>> But if I replace the first line with:
>>
>>                  str     =  fromCharCode(956);
>>
>> the code isn’t working anymore, as up to me "µ" was equal to
>> fromCharCode(956) or am I missing something?
>>
>> Have a nice day,
>>
>> Philippe
>>
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html