c# - Replacing specific parts of a string in an array -
i'm pretty familiar finding , replacing things in array, i'm having trouble finding out how replace specific parts of string. instance, first item in array string of sixteen random numbers 1786549809654768. how go replacing first twelve characters x's example?
because string
can translated , array of char
transform problem replace things in array problem:
char[] characters = input.tochararray(); // replace logic here string result = new string(characters);
or use substring
. assuming n
number of characters want replace beginning or string:
string result = new string('x', n) + input.substring(n);
Comments
Post a Comment