avatar
Untitled

Guest 13 28th Feb, 2025

MARKUP 0.80 KB
                                           
                         using System;
using System.Text.RegularExpressions;

class Program
{
    static void Main()
    {
        string input = "To jest przykładowy tekst 12345 z liczbami.";
        string result = AddLinkToFirstNumber(input);
        Console.WriteLine(result);
    }

    static string AddLinkToFirstNumber(string input)
    {
        if (string.IsNullOrEmpty(input))
            return input;

        // Znajduje pierwszy ciąg cyfr
        Match match = Regex.Match(input, @"\d+");
        if (match.Success)
        {
            string number = match.Value;
            string link = $"<a href='https://example.com/{number}'>{number}</a>";
            return input.Replace(number, link, 1);
        }

        return input;
    }
}
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM