Click here to Skip to main content
15,899,314 members
Home / Discussions / C#
   

C#

 
AnswerRe: Textfield doesn't get focused. HELP! Pin
Muammar©6-May-07 19:53
Muammar©6-May-07 19:53 
AnswerRe: Textfield doesn't get focused. HELP! Pin
AFSEKI7-May-07 1:55
AFSEKI7-May-07 1:55 
QuestionHow to insert multiple values in string efficiently? Pin
Adeel Chaudhry6-May-07 3:33
Adeel Chaudhry6-May-07 3:33 
AnswerRe: How to insert multiple values in string efficiently? Pin
Rob Graham6-May-07 3:51
Rob Graham6-May-07 3:51 
GeneralRe: How to insert multiple values in string efficiently? Pin
Adeel Chaudhry6-May-07 4:08
Adeel Chaudhry6-May-07 4:08 
AnswerRe: How to insert multiple values in string efficiently? Pin
Luc Pattyn6-May-07 4:07
sitebuilderLuc Pattyn6-May-07 4:07 
AnswerRe: How to insert multiple values in string efficiently? Pin
AFSEKI7-May-07 2:02
AFSEKI7-May-07 2:02 
AnswerRe: How to insert multiple values in string efficiently? Pin
gumi_r@msn.com7-May-07 5:26
gumi_r@msn.com7-May-07 5:26 
You could try the following code:
private string insertChars(string str, char insertChar, int[] insertIndexes)
{
    StringBuilder b = new StringBuilder(str.Length + insertIndexes.Length);
    int count = 0;

    for (int i = 0; i != str.Length;i++)
    {
        if (i == insertIndexes[count])
        {
            b.Append(insertChar);

            if (++count==insertIndexes.Length)
            {
                b.Append(str.Substring(i,str.Length-i));
                break;
            }
        }

        b.Append(str[i]);
    }

    return b.ToString();
}

For it to work, your index array must be sorted.
QuestionStuck with Network Pin
ThanhND3076-May-07 3:23
ThanhND3076-May-07 3:23 
QuestionReduce multiple characters to one, in a string! Pin
Adeel Chaudhry6-May-07 3:18
Adeel Chaudhry6-May-07 3:18 
AnswerRe: Reduce multiple characters to one, in a string! Pin
Rob Graham6-May-07 4:03
Rob Graham6-May-07 4:03 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Luc Pattyn6-May-07 4:12
sitebuilderLuc Pattyn6-May-07 4:12 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Adeel Chaudhry6-May-07 4:17
Adeel Chaudhry6-May-07 4:17 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Rob Graham6-May-07 4:40
Rob Graham6-May-07 4:40 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Luc Pattyn6-May-07 5:25
sitebuilderLuc Pattyn6-May-07 5:25 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Adeel Chaudhry6-May-07 4:15
Adeel Chaudhry6-May-07 4:15 
AnswerRe: Reduce multiple characters to one, in a string! Pin
Guffa6-May-07 4:25
Guffa6-May-07 4:25 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Adeel Chaudhry6-May-07 4:36
Adeel Chaudhry6-May-07 4:36 
GeneralRe: Reduce multiple characters to one, in a string! Pin
PIEBALDconsult6-May-07 6:52
mvePIEBALDconsult6-May-07 6:52 
AnswerRe: Reduce multiple characters to one, in a string! Pin
PIEBALDconsult6-May-07 4:41
mvePIEBALDconsult6-May-07 4:41 
GeneralRe: Reduce multiple characters to one, in a string! Pin
Adeel Chaudhry6-May-07 4:54
Adeel Chaudhry6-May-07 4:54 
GeneralRe: Reduce multiple characters to one, in a string! Pin
PIEBALDconsult6-May-07 4:57
mvePIEBALDconsult6-May-07 4:57 
AnswerRe: Reduce multiple characters to one, in a string! Pin
AFSEKI7-May-07 2:09
AFSEKI7-May-07 2:09 
QuestionTreeview challenge Pin
Rick van Woudenberg6-May-07 3:07
Rick van Woudenberg6-May-07 3:07 
AnswerRe: Treeview challenge Pin
Arun.Immanuel6-May-07 3:54
Arun.Immanuel6-May-07 3:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.