Click here to Skip to main content
15,922,015 members
Home / Discussions / C#
   

C#

 
GeneralRe: Boolean conversion Pin
5fingers17-Aug-11 0:57
5fingers17-Aug-11 0:57 
GeneralRe: Boolean conversion Pin
BobJanova17-Aug-11 0:11
BobJanova17-Aug-11 0:11 
GeneralRe: Boolean conversion Pin
5fingers17-Aug-11 0:55
5fingers17-Aug-11 0:55 
AnswerRe: Boolean conversion Pin
BobJanova16-Aug-11 1:14
BobJanova16-Aug-11 1:14 
GeneralRe: Boolean conversion Pin
5fingers16-Aug-11 5:23
5fingers16-Aug-11 5:23 
AnswerRe: Boolean conversion Pin
Dan Mos16-Aug-11 1:36
Dan Mos16-Aug-11 1:36 
GeneralRe: Boolean conversion Pin
5fingers16-Aug-11 5:25
5fingers16-Aug-11 5:25 
QuestionWhy does this not change my string? Pin
stephen.darling15-Aug-11 11:44
stephen.darling15-Aug-11 11:44 
Hello.

I took this small function from anouther project, and I slightly modified it to work with a string object.

It accepts a string, and it should add a '-' for every nth charicture, as set by the code.

private void encodeString(string input)
        {
           
            for (int i = 0; i < input.Length-1; i++)
            {

                if ((i + 1) % 6 == 0)
                {
                    input.Insert(i, "-");

                }


            }

        }


It simply does not alter the string.

I simply want to pass string...

string test = ("00000000000000000000");


and end up with...

string test = ("00000-00000-00000-00000");


Thank you for any help with this.
Kind Regards,

Stephen
AnswerRe: Why does this not change my string? Pin
Dave Kreskowiak15-Aug-11 11:49
mveDave Kreskowiak15-Aug-11 11:49 
GeneralRe: Why does this not change my string? Pin
stephen.darling15-Aug-11 11:55
stephen.darling15-Aug-11 11:55 
GeneralRe: Why does this not change my string? [modified] PinPopular
Dave Kreskowiak15-Aug-11 12:36
mveDave Kreskowiak15-Aug-11 12:36 
GeneralRe: Why does this not change my string? Pin
stephen.darling15-Aug-11 12:41
stephen.darling15-Aug-11 12:41 
AnswerRe: Why does this not change my string? Pin
Luc Pattyn15-Aug-11 11:50
sitebuilderLuc Pattyn15-Aug-11 11:50 
GeneralRe: Why does this not change my string? Pin
PIEBALDconsult15-Aug-11 15:28
mvePIEBALDconsult15-Aug-11 15:28 
GeneralRe: Why does this not change my string? Pin
Luc Pattyn15-Aug-11 15:37
sitebuilderLuc Pattyn15-Aug-11 15:37 
GeneralRe: Why does this not change my string? Pin
PIEBALDconsult15-Aug-11 15:41
mvePIEBALDconsult15-Aug-11 15:41 
AnswerRe: Why does this not change my string? Pin
Luc Pattyn15-Aug-11 15:53
sitebuilderLuc Pattyn15-Aug-11 15:53 
GeneralRe: Why does this not change my string? Pin
PIEBALDconsult15-Aug-11 16:01
mvePIEBALDconsult15-Aug-11 16:01 
AnswerRe: Why does this not change my string? Pin
Luc Pattyn15-Aug-11 16:30
sitebuilderLuc Pattyn15-Aug-11 16:30 
AnswerRe: Why does this not change my string? Pin
fcronin15-Aug-11 12:08
fcronin15-Aug-11 12:08 
GeneralRe: Why does this not change my string? Pin
stephen.darling15-Aug-11 12:14
stephen.darling15-Aug-11 12:14 
GeneralRe: Why does this not change my string? Pin
fcronin16-Aug-11 2:39
fcronin16-Aug-11 2:39 
GeneralRe: Why does this not change my string? Pin
stephen.darling16-Aug-11 7:27
stephen.darling16-Aug-11 7:27 
AnswerRe: Why does this not change my string? Pin
PIEBALDconsult15-Aug-11 15:30
mvePIEBALDconsult15-Aug-11 15:30 
AnswerRe: Why does this not change my string? [modified] Pin
Shameel15-Aug-11 21:33
professionalShameel15-Aug-11 21:33 

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.