Podemos usar la función "Remove" para eliminar al ultimo caracter de nuestro texto: myText = myText.Remove(myText.Length - 1, 1); Por ejemplo, si queremos eliminar si el ultimo caracter de nuestro texto es una coma: if(myText.EndsWith(",")) { myText = myText.Remove(myText.Length - 1, 1); }
Etiqueta: caracter
Dividir un String con la función Split() por Uno o Varios Carácteres Diferentes en C#
Podemos dividir un String fácilmente con la funcion Split y pasándole un carácter por el cual queremos dividir el texto. Si por ejemplo tenemos el String "1,2,3,4" y hacemos el Split de la siguiente forma: String source= "1,2,3,4"; //Original Text String[] result = source.Split( ',' ); //Separate the original text by one character (",") El …
Sigue leyendo Dividir un String con la función Split() por Uno o Varios Carácteres Diferentes en C#