I m a beginner, can you give an example of the specific usage of split and replace in C?

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

    string a = "a,b,c";

    string arr = ',');Based on the comma, it is divided into an array of strings, and the contents of the array are three values: a, b, and c.

    string s = ',', ';');This is a semicolon instead of a comma, and the result is: a; b;c

  2. Anonymous users2024-02-04

    split is to separate strings into arrays.

    For example, string str="kk;dd;ff;gg;hh";

    string ss=';');

    replace is to replace some characters in a string with new characters.

    string str="kk;dd;ff;gg;hh";

    string ss=";","-");

    Then the replaced string is kk-dd-ff-gg-hh, which is the most commonly used usage, split and replace are different from one parameter is char and the other is string

    Hope mine is helpful to you.

  3. Anonymous users2024-02-03

    It's all string methods.

    replace the specified character (string) match in the string with other characters (string);

    split divides the string into an array of strings according to the specified delimiter;

    If there is a path string:

    filenm = "c://temp";

    Use replace:

    abc", "edf");

    filename becomes"c://temp";

    Use split:

    string delimstr = "\\";

    char delimiter = ;

    string strs = ;

    string str2 = strs[ -1];

    The resulting array strs str2=

  4. Anonymous users2024-02-02

    split, which splits the string into an array according to the specified symbol format, and returns an array.

    replace, which replaces the specified characters in the string with the specified content, and returns the string.

  5. Anonymous users2024-02-01

    What are you talking about?

    The main usage is to split the input string according to the characters in the specified set, and return the divided string array.

  6. Anonymous users2024-01-31

    In fact, there are two main implementations.

    char chars)

    Multiple splits for characters.

    string strings,stringemptyoption option)

    Multiple splits for strings. The second parameter refers to whether or not to return an empty split.

    Such as:"abcdabc".split('b') results in a new string

    abcdabc".split(‘b’,'c'The result is a new string

    abcdabc".split(new string,"Empty strings are not returned"The result is a new string

    abcdabc".split(new string,"Returns an empty string"The result is a new string

  7. Anonymous users2024-01-30

    Use. The net reflector decompiler looks at the overload of the method.

    After understanding, write a demo test to deeply understand the specific usage of split.

  8. Anonymous users2024-01-29

    It's just the idea of splitting into arrays.

  9. Anonymous users2024-01-28

    c) Returns a substring of strings containing the character c.

  10. Anonymous users2024-01-27

    The landlord wants to remove the enter and " " in the text and get the data in the text.

    is the text that is read in.

    2. string readtext = "", "@").split('@');

    This will make the data into the readtext array, so you can work with the array.

  11. Anonymous users2024-01-26

    Floors 1 and 2 are right, such as:

    string strtest1 = "";

    string strtest2 = "";

    string strre = string ","To split the characters");

    strtest1 = strre[0].trim().tostring();

    strtest2 = strre[1].trim().tostring();

    string test=“123a|1231”.replace("|","");

  12. Anonymous users2024-01-25

    1.From the regex match to item 5, take the grouped value named txt and include it"

    Replace with"|"。

    2.Replace the value of str with'|'Split into a string array (a collection of multiple strings) and get the first string.

  13. Anonymous users2024-01-24

    split converts strings into arrays.

  14. Anonymous users2024-01-23

    split is a split, you want to remove, you should use the replace method.

  15. Anonymous users2024-01-22

    string str="a|b|c|d"

    |0].tostring())

    string strarray = '|

    response,write(strarray[0]);

    That's OK, maybe the difference in quotation marks.

  16. Anonymous users2024-01-21

    public static string composemessage(string source, string...replacement) "1;

    string pattern = , end);

    source = , replacement[i]);

    return source;

    public static void main(string args) Hello! The amount of this purchase is in your account.

    The balance on is $"。

    replace.

  17. Anonymous users2024-01-20

    public class q272956869

    public static void main(string args)

    string temp = Dear customer $Hello! The amount of this purchase is $, and the balance on your account $ is $. "

    string msg = composemessage(temp, "Sister Feng", 8090", yy-009", 678");

    public static string composemessage(string template, string name, string amount,string account,string balance)

    template="$name);

    template="$amount);

    template="$account);

    template="$balance);

    return template;

Related questions
13 answers2024-02-09

There are no bugs in this program It may be that you are not proficient in using your programming software. Did you use it? If so, you can create a new text document. >>>More

7 answers2024-02-09

Hehe, I'm playing guard and small front.

I don't know what position you're going to play. >>>More

7 answers2024-02-09

Badminton Teaching Expert Pulse 15 - Full Court Movement Footwork.

5 answers2024-02-09

For beginners, you can use liquid eyeliner with a hard nib, and then switch to a soft nib when you are proficient. >>>More

7 answers2024-02-09

Enter the iPhone phone query on it, click on the second result, enter the mobile phone serial number, and you can query the mobile phone details. >>>More