Character conversion

Character conversion - Messages

#1 Posted: 6/17/2018 4:36:37 PM
Brian Runagle

Brian Runagle

13 likes in 27 posts.

Group: User

Hi

I'm looking for the equivalent to Excel ASCII functions
code("a" )=97 (space after " added to avoid a winking Smiley!)
char(97)="a"
and so on.

Does anyone know if they're hidden in a Plugin somewhere, or if there's an easy way to create them?

Many thanks
Brian
#2 Posted: 6/17/2018 5:15:58 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

"a"
#3 Posted: 6/17/2018 5:34:52 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

There are some conversion functions in Maxima.

ascii.png

ascii.sm (4 KiB) downloaded 39 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
bdrunagle 6/17/2018 6:25:00 PM
#4 Posted: 6/17/2018 6:49:18 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

Hello.

unicode_symb_3.PNG

Another example is available here: https://en.smath.info/forum/yaf_postsm47084_SMath-Studio-0-99-6617--12-February-2018.aspx#post47084
1 users liked this post
bdrunagle 6/18/2018 3:45:00 AM
#5 Posted: 6/18/2018 3:45:55 AM
Brian Runagle

Brian Runagle

13 likes in 27 posts.

Group: User

Thanks for your help gentlemen.
Brian
#6 Posted: 6/18/2018 11:42:50 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

Hello.

unicode_symb_3.PNG

Another example is available here: https://en.smath.info/forum/yaf_postsm47084_SMath-Studio-0-99-6617--12-February-2018.aspx#post47084



There seems to be something special with the characters generated this way. They will be backconverted to code sequence if used in Maxima region, label region or table region.

Zeichenketten_019.png
Zeichenketten.sm (57 KiB) downloaded 32 time(s).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Posted: 6/18/2018 12:25:29 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

There are some conversion functions in Maxima.

ascii.png

ascii.sm (4 KiB) downloaded 39 time(s).



Now I know why cint("A" ) does not work. It is a translation problem from SMath to Maxima, see SS-3543.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#8 Posted: 6/18/2018 12:29:10 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

They are special indeed, you can see it by exposing the plain text with copy/paste... The syntax is handled at code level by the math region (like a bbcode or a markdown text)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#9 Posted: 6/18/2018 12:50:19 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

They are special indeed, you can see it by exposing the plain text with copy/paste... The syntax is handled at code level by the math region (like a bbcode or a markdown text)



This is strange. I understand that the \xxxx\ markup can be convenient at input time or if the characters are generated from computed codes. But why need they to be stored this way? SMath can store and display the corresponding symbols directly.

I'd vote for an instant conversion and storage as unicode character, at least for those which actually can be displayed.
This would be closer to the paradigm "what you see is what is done".
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
frapuano 6/18/2018 1:46:00 PM
#10 Posted: 6/18/2018 2:06:19 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

But why need they to be stored this way? SMath can store and display the corresponding symbols directly.



Because many characters are taken by the math syntax... +-*/.,:;<>(){}@#! (and many more)... converting the code in character may cause trouble while reading back the code.

2018-06-18 19_11_13-Window.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
frapuano 6/18/2018 2:19:00 PM
#11 Posted: 6/19/2018 5:19:22 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

I see the point. But as far as string literals are concerned, a conversion could be done without harm (except for string markup character).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#12 Posted: 6/19/2018 7:43:29 AM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Since we have num2str() and str2num() I don't think it is a good idea neither when they are in a math string; better to have some functions like in maxima to do it explicitely. Apart this, the only other improvement that I might think is to allow \C\ where C is the special character instead of his code (not sure if might have side effects, though).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#13 Posted: 6/19/2018 12:29:06 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Indeed, a function to generate un-encoded/un-escaped pristine special symbols for use in strings would do the job.

Then I would recommend to not conceal the encoding/escaping of symbols in strings but rather just expose the raw version. Then nobody would expect to see the pretty-printed version in custom regions.







Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#14 Posted: 6/19/2018 2:40:57 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

Not sure if this is what you mean, but we have GlobalProfile.ReplaceUnicodeChars(text) to decode term text.
  • New Posts New Posts
  • No New Posts No New Posts