locked
Acronym after the title and DATE.NOW RRS feed

  • Question

  • User-1537697891 posted
    I want the
                acronym of “laugh out loud” for example which is LOL.*@


    @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.Title) @*Here... I want the acronym of “laugh out loud” for example which is LOL.*@ <td> @Html.DisplayFor(modelItem => item.BorrowDate) @*Here... I want to put the borrow date*@ </td> <td> @Html.DisplayFor(modelItem => item.Type) </td> <td> @Html.DisplayFor(modelItem => item.Category.CategoryName) </td> <td> @Html.ActionLink("Edit", "Edit", new { id=item.Id }) | @Html.ActionLink("Details", "Details", new { id=item.Id }) | @Html.ActionLink("Delete", "Delete", new { id=item.Id }) </td> </tr>


    Saturday, October 3, 2020 12:27 PM

All replies

  • User475983607 posted

    This is a simple dictionary.  Create a Database table that where the key is LOL and the content is laugh out loud. 

    Saturday, October 3, 2020 12:33 PM
  • User711641945 posted

    Hi janadde77,

    Here is a working demo like below:

    @using System.Text.RegularExpressions;
    
    @foreach (var item in Model)
    {
        <tr> 
            <td>
                @String.Join("",Regex.Matches(item.Title, @"(?<=^| )\w")
                .Cast<Match>
                    ()
                    .Select(m => m.Value.ToUpper())
                    .ToArray()
                    )
            </td>
        </tr>
    }

    Best Regards,

    Rena

    Monday, October 5, 2020 6:15 AM