Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleValidacion
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Yo lo veria haciendo una funcion que remplace el valor en la cadena.
- string CadenaValidacion = $"Success\nTony Simoes\n(1)\nMS-9-9-2-00-000-0-1\nXamarinDiplomado3.0-Lab11";
- string resultado = Incrementa(CadenaValidacion);
- Console.WriteLine(resultado);
- Console.ReadKey();
- }
- //La cadena de texto que ves al final viene de los servidores en internet y se te dice que solo debes hacer una peticion.
- static string Incrementa (string resultado)
- {
- char numeroUno = resultado.First(x => x == '1');
- List<char> test = resultado.ToList();
- for (int i = 0; i < test.Count; i++)
- {
- if (test[i] == numeroUno)
- {
- test[i] = '2';
- break;
- }
- }
- StringBuilder str = new StringBuilder();
- foreach (var item in test)
- {
- str.Append(item);
- }
- return str.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement