A question about string handling

Updated on technology 2024-05-10
10 answers
  1. Anonymous users2024-02-10

    I originally wanted to use it, but I found it a little difficult to fight together in the end;

    If you make sure that there is only one in this string"frist"And one"last"It's easy to use.

    string str = "1212firstabcdefglast3434";

    string a = "last");

    string b = a[0].spit("first");

    if(>1 &&1){

    str = b[0] +b[1].touppercase() a[1];

    There is no test, it should work.

  2. Anonymous users2024-02-09

    Via indexof("first"Locate to first

    Then use the touppercase method to convert lowercase to uppercase.

  3. Anonymous users2024-02-08

    The writing on the 2nd floor is more perfect, and there is a small place to pay attention to, which is to change the 4 of the last line to:

  4. Anonymous users2024-02-07

    I basically agree with the method on the second floor.

  5. Anonymous users2024-02-06

    Summary. \0'is a character with an ASCII code of 0, which does not cause any control action and is not a character that can be displayed. For example, string constants"china", which on the surface looks like it's only 5 characters, but in reality it takes up 6 bytes in memory,'c'、'h'、'i'、'n'、'a'、'0'One byte each.

    If you want to output that string,'\0'Won't output. That is, although there are actually 6 characters in total,'\0'Also included in it, but when exporting'\0'Won't output. The system starts with the first character'c'Start outputting characters one by one until you encounter them'\0', the string ends and the output stops.

    Handles string constants that provide that string.

    Hello, for your question, the answer I give is: String constant: A sequence of multiple pei characters enclosed in double quotation marks by the person in filial piety, such as"a"The first draft of the "i love u" string is essentially an array of multiple characters.

    A character occupies only one byte in memory, while a string is essentially an array of characters made up of multiple characters. C states that at the end of each string constant, the system automatically adds a character'\0'As the "end marker" of the string, the system uses this to determine whether the string is over. There is one point to emphasize here:

    0'It is added automatically by the system, not artificially.

    0'is a character with an ASCII code of 0, which does not cause any control action and is not a character that can be displayed. For example, string constants"china", which on the surface looks like it's only 5 characters, but in reality it takes up 6 bytes in memory,'c'、'h'、'i'、'n'、'a'、'0'One byte each. If you want to output that string,'\0'Won't output.

    That is, although there are actually 6 characters in total,'\0'Also included in it, but the output is buried when the royal'\0'Won't output. The system starts with a character from the first god'c'Start throwing the characters out of the blind rock one by one until you come across'\0', the string ends and the output stops.

  6. Anonymous users2024-02-05

    1. trim() is to remove the first and last spaces.

    2、" ", "");Remove all spaces, including the beginning and end, and the middle.

    Copy ** ** As follows:

    string str = " hell o ";

    string str2 = " ", "");

    3. or replaceall(" +","");Remove all spaces.

    4、str = .replaceall("\\s*", "");

    It can replace most whitespace characters, not limited to spaces.

    s can match any of the whitespace characters, such as spaces, tabs, page breaks, etc.

    The details are as follows: 1. Introduction.

    Programming is the Chinese abbreviation of writing programs, that is, to let the computer solve a certain problem on behalf of the computer, to stipulate a certain calculation method for a certain computing system, is the process of the computing system to run according to the calculation method, and finally get the corresponding results.

    In order for the computer to understand human intentions, human beings must tell the computer the ideas, methods and means of the problem to be solved in a form that the computer can understand, so that the computer can work step by step according to human instructions and complete a specific task. This process of communication between people and computing systems is programming.

    2. Assembler.

    Compiler. To write a computer program using assembly language, programmers still need to be very familiar with the hardware structure of the computer system, so the programming itself is still inefficient and cumbersome. However, it is precisely because of the close relationship between assembly language and computer hardware systems that assembly language is still a very effective programming tool in some specific occasions, such as system core programs and real-time control programs that require high spatio-temporal efficiency.

    3. Execution principle.

    The computer cannot directly recognize, understand, and execute the source program other than the machine language, and must be converted into something that the computer can execute directly. There are two ways to convert a source program written in a high-level programming hardware programming language into a machine target program: interpretation and compilation.

  7. Anonymous users2024-02-04

    String constants: The characters in the string are stored in a contiguous area of memory, and the characters are empty' \0'Automatically appended to the tail of the string as the end flag of the string. Therefore, a string constant with n characters should occupy (n+1) bytes in memory.

    Here, when str is replaced with a macro, it will only be replaced with the string 12345, and will not be added later'\0'Target.

    So c.

  8. Anonymous users2024-02-03

    What is a string constant? Constants cannot be changed.

    The string "1234" can't be replaced by str, and str can only be replaced by "12345"?

    tr can only replace "12345"? The role of define is to replace it, then you have to know the advantages of using define:

    1. The str you define is "12345", and you don't need to use "12345" where you need to use "12345" in the future, just use strMaybe you don't find it convenient, then you can do this: define pi When using pi, you can just use pi, no more typing, or something like this:

    #define a "you can deal some date easiiy by this way".Isn't it much easier to type than this one? If a program is used 10,000 times"you can deal some date easiiy by this way"You'll think it's nice to define.

    2. The pi written in your program is, but if one day the value of pi is suddenly published is wrong, it should be, then your program uses the value of pi 1000000 times, you have to change it so many times? No, if you used to use define, you just need to change define pi to defne pi, it's so arbitrary. Note:

    Here the value of pi has changed, you can change it as you like. That's what it does.

  9. Anonymous users2024-02-02

    It seems that string constants also need to be predefined with a constant name.

  10. Anonymous users2024-02-01

    The real type, also known as floating-point type, has an integer number without a decimal point and is another type.

    Type, Name, Range, Significant Digits, Number of Bytes.

    real 15 16 8

    Double precision double 15 16 8

    48-bit real real48 11 12 6

    Single 7 8 4

    Extended 19 20 10

    Computational comp -2 63+1 2 63-1 19 20 8

    Currency 19 20 8

Related questions
7 answers2024-05-10

Do it by your train of thought.

Method 1. string strnumber="200m"; >>>More

25 answers2024-05-10

Do you mean to say that a is a value of 10 or does a literally mean 10? >>>More

8 answers2024-05-10

It's really hard to say casually if you haven't done this. You can try using the comparevalidator control, but this control compares the values of two text boxes, one character at a time. You need to write your own ** transformation.

10 answers2024-05-10

The meaning of the title is said upstairs.,Here's a **.。 >>>More

17 answers2024-05-10

Let's talk about the idea first:

Get the last one within this string. location, which is the index. >>>More