Would you like to react to this message? Create an account in a few clicks or log in to continue.

    String Operations

    avatar
    Admin
    Admin


    Posts : 77
    Join date : 2009-07-28

    String Operations Empty String Operations

    Post  Admin Tue Jul 28, 2009 5:35 am

    Split
    CSharp string split function , returns an array of strings containing the substrings delimited by the given System.Char array.

    Code:
    string.split(string[] separator)
    /*
    Parameters:
    separator - the given delimiter
    Returns:
    An array of Strings without the delimiter.
    */
    string a = "A/B,C;D";
    string[] b = new String[a.Length - 1];
    char [] delimiters = {'/',',',';'};
    b = a.Split(delimiters);
    //Returns :: ABCD.
    }
    avatar
    Admin
    Admin


    Posts : 77
    Join date : 2009-07-28

    String Operations Empty Re: String Operations

    Post  Admin Tue Jul 28, 2009 5:49 am

    Substring
    Another CSharp splitting function, returns a string that starts at a given index (1) or starts at a given index and ends after a integer of indexes. (2)
    Code:

    string str = another_string.Substring(int i,int length after i);
    avatar
    Admin
    Admin


    Posts : 77
    Join date : 2009-07-28

    String Operations Empty Re: String Operations

    Post  Admin Tue Jul 28, 2009 7:59 am

    Clone
    The return value is not an independent copy of this instance; it is simply another view(object) of the same data.
    In other words, a cheap (memory wise) alternative for output processes.

    Code:
    string.Clone();
    avatar
    Admin
    Admin


    Posts : 77
    Join date : 2009-07-28

    String Operations Empty Re: String Operations

    Post  Admin Tue Jul 28, 2009 8:15 am

    Compare
    Compares strings and returns an integer signed/unsigned that depends on the alphabetical order.
    Usually used for sorting data.

    Signatures :
    Code:

    Compare(String,String) returns -1,0,1;
    Compare(String,String,Boolean) // Bool is for Ignore/honor upper or lower case
    avatar
    Admin
    Admin


    Posts : 77
    Join date : 2009-07-28

    String Operations Empty Re: String Operations

    Post  Admin Tue Jul 28, 2009 8:19 am

    Length
    Property that returns the number of characters in a string
    Code:
    string.Length;
    StartsWith - EndsWith
    A bool method that returns true or false
    Code:
    if (string.StartsWith("#")) ...
    Equals
    A bool method that returns true or false if string 1 == string2
    Code:
    String1.Equals(String2);
    IndexOf
    Returns the first position in a string of a string/Char value "#".Search starts at startIndex.
    (1)
    Code:
    String.IndexOf("=",StartIndex")
    sinon char '='
    Insert(StartIndex,string value)
    Self Defined

    Sponsored content


    String Operations Empty Re: String Operations

    Post  Sponsored content

      Similar topics

      -

      Current date/time is Mon May 20, 2024 7:52 am