How can I get the string.length meet Oracle system requirement when the string contains both chinese characters and english characters?

Description(“中国good”) field have both Chinese characters and English characters, however, Oracle system rule: one Chinese character is equal to three English characters.
I get Description.length=6, in fact, i want get it’s length equal 10 which meet oracle rule.

Hi @Lori ,

You can use this code to get the actual length including your Chinese characters in the string. We have to get the byte code length.

Encoding.UTF8.GetByteCount("中国good")

To work with Encoding, you need to include System.Text namespace in your Import tab.
This will give you the output you are looking for.

image
@sarathi125

Check with this

@sarathi125
One more question: if Description field have both Chinese characters and English characters and it’s length very long, however I only want to get substring which it’s length <240 bytes, what should i do? thanks.

@sarathi125 Could you help me again, thanks.

@Lori ,

Check with the attached xaml, it may help you to get some insights on it.
SubstringUnicodeChars.xaml (8.5 KB)

Hi,

It’s duplicated post… I replied the following post, FYI.

Regards,

@sarathi125
Thank you for your continued enthusiastic help. you gave me a lot of enlightenment. It was my fault because I was not clarify my real requirements at the beginning.

@Yoichi
Thank you so much, that’s what I need! :+1: :+1:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.