Use of REPLACEB substitution functions

Source: Internet
Author: User

First, REPLACEB grammar

REPLACEB (Old_text, start_num, Num_bytes, New_text)

Old_text: Required. The text to replace some of its characters.

Start_num: Required. The position of the character in the old_text to replace with new_text.

Num_chars: Required. You want replace to replace the number of characters in old_text with New_text.

Num_bytes: Required. You want REPLACEB to replace the number of bytes in old_text with Ew_text.

New_text: Required. The text that will be used to replace the characters in old_text.

To put it simply, the Chinese syntax for this function is:

REPLACEB (original character, replace from this position, replace the length, replace with what character)

Note that the substitution of the function is, in bytes, substituted. A Chinese account of two bytes, please note that the number of bytes in Chinese is two bytes.

Two, Replaceb function use example

Let's look at the table directly.

A2 is the original character, B2 is the replacement character, we first parse the original character.

The character for the Volkswagen computer ABC, which contains the Chinese popular computer, then, a Chinese war Two bytes, so, the general computer in the Chinese language of the length is 2.

Here's a concrete example.

Computer Tutorials

In the diagram above, we analyze the replacement process directly using the function =replaceb (a2,1,2, "yes") below.

Replace the A2 character, replaced by the word, replaced with a 1-bit, replacing two-length characters, just to make up two characters, just completely replaced by the word.

Then look at an example.

=REPLACEB (a2,3,3, "yes"), the replacement process of the formula is analyzed as follows:

Replace the character in the third position of the A2 with the word, replacing the total three lengths.

The third position of the character is the word, the word for two characters of the length, just be completely replaced, and the formula replaces is three lengths, the word occupies two lengths, still has one length, then, is the word, the meter word is also Chinese, occupies two byte length, but at this time only replaces one, then, can not leave half of the word, Because the characters cannot be displayed so that the count is only two characters long, it is still replaced, but a space is left. This is the byte of the way to replace characters, please be careful to understand.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.