The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to count wide characters in a string
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

flycs99

China
8 Posts

Posted - 06/13/2020 :  9:41:19 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
For example:
sting str="ああ";
printf("%d\n",str.Count('あ'));


The return value is 0.

According to https://www.originlab.com/doc/OriginC/ref/string-Count,wide characters are supported.
Please help me to count the wide characters.

cpyang

USA
1121 Posts

Posted - 06/14/2020 :  4:56:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That documentation page might be wrong, or out dated, since Origin has been changed to use Unicode, UTF8. We updated Labtalk to properly handle Unicode, but OriginC was not updated for that.

Best will be to code in Python in Origin. We are making a lot of improvement in this area, you can request a beta of 2021 try out Python.

CP
Go to Top of Page

EleanorGagne

USA
2 Posts

Posted - 06/30/2020 :  12:35:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by flycs99

For example:
sting str="ああ";
printf("%d\n",str.Count('あ'));
https://texttospeech.onl
https://mortgagecalculator.tech

The return value is 0.

According to https://www.originlab.com/doc/OriginC/ref/string-Count,wide characters are supported.
Please help me to count the wide characters.


size_t strlen(
const char *str
);
size_t wcslen(
const wchar_t *str
);
size_t _mbslen(
const unsigned char *str
);
size_t _mbslen_l(
const unsigned char *str,
_locale_t locale
);
size_t _mbstrlen(
const char *str
);
size_t _mbstrlen_l(
const char *str,
_locale_t locale
);
Go to Top of Page

flycs99

China
8 Posts

Posted - 07/01/2020 :  01:24:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

That documentation page might be wrong, or out dated, since Origin has been changed to use Unicode, UTF8. We updated Labtalk to properly handle Unicode, but OriginC was not updated for that.

Best will be to code in Python in Origin. We are making a lot of improvement in this area, you can request a beta of 2021 try out Python.

CP




Thank you for your reply. It is helpful. I will try python.
Go to Top of Page

flycs99

China
8 Posts

Posted - 07/01/2020 :  01:42:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by EleanorGagne

quote:
Originally posted by flycs99

For example:
sting str="ああ";
printf("%d\n",str.Count('あ'));
https://texttospeech.onl
https://mortgagecalculator.tech

The return value is 0.

According to https://www.originlab.com/doc/OriginC/ref/string-Count,wide characters are supported.
Please help me to count the wide characters.


size_t strlen(
const char *str
);
size_t wcslen(
const wchar_t *str
);
size_t _mbslen(
const unsigned char *str
);
size_t _mbslen_l(
const unsigned char *str,
_locale_t locale
);
size_t _mbstrlen(
const char *str
);
size_t _mbstrlen_l(
const char *str,
_locale_t locale
);


Thank you for your reply. This solution is very helpful and I can really get everything in the wide character strings. I will find the originC files for these functions.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000